Interface EntityMappingType

    • Method Detail

      • getEntityName

        String getEntityName()
        The entity name.

        For most entities, this will be the fully-qualified name of the entity class. The alternative is an explicit entity-name which takes precedence if provided

        API Note:
        Different from Entity.name(), which is just a glorified SQM "import" name
      • getRepresentationStrategy

        default EntityRepresentationStrategy getRepresentationStrategy()
        Describes how the entity is represented in the application's domain model.
      • getIdentifierTableDetails

        TableDetails getIdentifierTableDetails()
        Details for the table that defines the identifier column(s) for an entity hierarchy.
      • visitQuerySpaces

        void visitQuerySpaces​(Consumer<String> querySpaceConsumer)
        Visit each "query space" for the mapped entity.
        API Note:
        "Query space" is simply the table expressions to which the entity is mapped; the name is historical.
      • isAbstract

        default boolean isAbstract()
        Whether this entity is defined as abstract using the Java abstract keyword
      • hasSubclasses

        default boolean hasSubclasses()
        Whether this entity mapping has any subtype mappings
      • getSuperMappingType

        default EntityMappingType getSuperMappingType()
        The mapping for the entity which is the supertype for this entity mapping.
        Returns:
        The supertype mapping, or null if there is no supertype
        API Note:
        This need not be the direct superclass of the entity as it is driven by mapping.
      • getMappedSuperclass

        default String getMappedSuperclass()
        Get the name of the entity that is the "super class" for this entity
        See Also:
        getSuperMappingType()
      • isTypeOrSuperType

        default boolean isTypeOrSuperType​(EntityMappingType targetType)
        Whether the passed entity mapping is the same as or is a supertype of this entity mapping
      • getSubclassId

        default int getSubclassId()
        A value that uniquely identifies an entity mapping relative to its inheritance hierarchy
      • getSubclassEntityNames

        default Set<String> getSubclassEntityNames()
      • isExplicitPolymorphism

        boolean isExplicitPolymorphism()
        Is this class explicit polymorphism only?
      • getDiscriminatorValue

        Object getDiscriminatorValue()
        The discriminator value which indicates this entity mapping
      • getDiscriminatorSQLValue

        default String getDiscriminatorSQLValue()
      • pruneForSubclasses

        default void pruneForSubclasses​(TableGroup tableGroup,
                                        Map<String,​EntityNameUse> entityNameUses)
        Adapts the table group and its table reference as well as table reference joins in a way such that unnecessary tables or joins are omitted if possible, based on the given treated entity names.

        The goal is to e.g. remove join inheritance "branches" or union selects that are impossible.

        Consider the following example: class BaseEntity {} class Sub1 extends BaseEntity {} class Sub1Sub1 extends Sub1 {} class Sub1Sub2 extends Sub1 {} class Sub2 extends BaseEntity {} class Sub2Sub1 extends Sub2 {} class Sub2Sub2 extends Sub2 {}

        If the treatedEntityNames only contains Sub1 or any of its subtypes, this means that Sub2 and all subtypes are impossible, thus the joins/selects for these types shall be omitted in the given table group.

        Parameters:
        tableGroup - The table group to prune subclass tables for
        entityNameUses - The entity names under which a table group was used.
      • pruneForSubclasses

        @Deprecated(forRemoval=true)
        default void pruneForSubclasses​(TableGroup tableGroup,
                                        Set<String> treatedEntityNames)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Adapts the table group and its table reference as well as table reference joins in a way such that unnecessary tables or joins are omitted if possible, based on the given treated entity names. The goal is to e.g. remove join inheritance "branches" or union selects that are impossible. Consider the following example: class BaseEntity {} class Sub1 extends BaseEntity {} class Sub1Sub1 extends Sub1 {} class Sub1Sub2 extends Sub1 {} class Sub2 extends BaseEntity {} class Sub2Sub1 extends Sub2 {} class Sub2Sub2 extends Sub2 {} If the treatedEntityNames only contains Sub1 or any of its subtypes, this means that Sub2 and all subtypes are impossible, thus the joins/selects for these types shall be omitted in the given table group.
        Parameters:
        tableGroup - The table group to prune subclass tables for
        treatedEntityNames - The entity names for which path usages were registered
      • getIdentifierMapping

        EntityIdentifierMapping getIdentifierMapping()
        Mapping details for the entity's identifier. This is shared across all entity mappings within an inheritance hierarchy.
      • optimisticLockStyle

        default OptimisticLockStyle optimisticLockStyle()
        The type of optimistic locking, if any, defined for this entity mapping
      • getNaturalIdMapping

        NaturalIdMapping getNaturalIdMapping()
        The mapping for the natural-id of the entity, if one is defined
      • getRowIdMapping

        EntityRowIdMapping getRowIdMapping()
        The mapping for the row-id of the entity, if one is defined.
      • getNumberOfAttributeMappings

        default int getNumberOfAttributeMappings()
        The total number of attributes for this entity, including those declared on supertype mappings
        Specified by:
        getNumberOfAttributeMappings in interface ManagedMappingType
      • findDeclaredAttributeMapping

        AttributeMapping findDeclaredAttributeMapping​(String name)
        Find an attribute-mapping, declared on this entity mapping (not super or subs), by name
      • getNumberOfDeclaredAttributeMappings

        default int getNumberOfDeclaredAttributeMappings()
        Get the number of attributes defined on this entity mapping - do not access attributes defined on the super
      • getDeclaredAttributeMappings

        AttributeMappingsMap getDeclaredAttributeMappings()
        Get access to the attributes defined on this class - do not access attributes defined on the super
      • visitDeclaredAttributeMappings

        void visitDeclaredAttributeMappings​(Consumer<? super AttributeMapping> action)
        Visit attributes defined on this class - do not visit attributes defined on the super
      • visitAttributeMappings

        default void visitAttributeMappings​(Consumer<? super AttributeMapping> action,
                                            EntityMappingType targetType)
        Visit the mappings, but limited to just attributes defined in the targetType or its super-type(s) if any.
        API Note:
        Passing null indicates that subclasses should be included. This matches legacy non-TREAT behavior and meets the need for EntityGraph processing
      • visitSubTypeAttributeMappings

        default void visitSubTypeAttributeMappings​(Consumer<? super AttributeMapping> action)
        Walk this type's attributes as well as its sub-type's
      • visitSuperTypeAttributeMappings

        default void visitSuperTypeAttributeMappings​(Consumer<? super AttributeMapping> action)
        Walk this type's attributes as well as its super-type's
      • getNaturalIdLoader

        NaturalIdLoader<?> getNaturalIdLoader()
        Access to performing natural-id database selection. This is per-entity in the hierarchy
      • getMultiNaturalIdLoader

        MultiNaturalIdLoader<?> getMultiNaturalIdLoader()
        Access to performing multi-value natural-id database selection. This is per-entity in the hierarchy
      • createRootTableGroup

        default TableGroup createRootTableGroup​(boolean canUseInnerJoins,
                                                NavigablePath navigablePath,
                                                String explicitSourceAlias,
                                                SqlAliasBase explicitSqlAliasBase,
                                                Supplier<Consumer<Predicate>> additionalPredicateCollectorAccess,
                                                SqlAstCreationState creationState)
        Description copied from interface: RootTableGroupProducer
        Create a root TableGroup as defined by this producer
        Specified by:
        createRootTableGroup in interface RootTableGroupProducer
        Parameters:
        canUseInnerJoins - Whether inner joins can be used when creating table-references within this group
        navigablePath - The overall NavigablePath for the root
        explicitSourceAlias - The alias, if one, explicitly provided by the application for this root
        explicitSqlAliasBase - A specific SqlAliasBase to use. May be null indicating one should be created using the SqlAliasBaseGenerator from creationState
        additionalPredicateCollectorAccess - Collector for additional predicates associated with this producer
        creationState - The creation state
      • getPartName

        default String getPartName()
        Description copied from interface: ModelPart
        The local part name, which is generally the unqualified role name
        Specified by:
        getPartName in interface ModelPart