Package org.hibernate.metamodel.mapping
Interface EntityMappingType
- All Superinterfaces:
Bindable,Discriminable,EntityValuedModelPart,FetchableContainer,FilterRestrictable,JdbcMappingContainer,Loadable,ManagedMappingType,MappingModelExpressible,MappingType,ModelPart,ModelPartContainer,Restrictable,RootTableGroupProducer,SoftDeletableModelPart,TableGroupProducer,WhereRestrictable
- All Known Subinterfaces:
EntityPersister,InFlightEntityMappingType
- All Known Implementing Classes:
AbstractEntityPersister,AnonymousTupleEntityValuedModelPart,JoinedSubclassEntityPersister,SingleTableEntityPersister,UnionSubclassEntityPersister
public interface EntityMappingType
extends ManagedMappingType, EntityValuedModelPart, Loadable, Restrictable, Discriminable, SoftDeletableModelPart
Mapping of an entity
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceNested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.Bindable
Bindable.JdbcValuesBiConsumer<X,Y>, Bindable.JdbcValuesConsumer Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.ModelPart
ModelPart.JdbcValueBiConsumer<X,Y>, ModelPart.JdbcValueConsumer -
Method Summary
Modifier and TypeMethodDescriptiondefault voidapplyBaseRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String, Filter> enabledFilters, boolean onlyApplyLoadByKeyFilters, Set<String> treatAsDeclarations, SqlAstCreationState creationState) Applies the base set of restrictions.default voidapplyDiscriminator(Consumer<Predicate> predicateConsumer, String alias, TableGroup tableGroup, SqlAstCreationState creationState) Apply the discriminator as a predicate via thepredicateConsumerdefault voidapplyFilterRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String, Filter> enabledFilters, boolean onlyApplyLoadByKeyFilters, SqlAstCreationState creationState) Applies just theFiltervalues enabled for the associated entitydefault voidapplyWhereRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, SqlAstCreationState creationState) Apply theSQLRestrictionrestrictionsdefault EntityMappingTypedefault TableReferencecreatePrimaryTableReference(SqlAliasBase sqlAliasBase, SqlAstCreationState creationState) default TableGroupcreateRootTableGroup(boolean canUseInnerJoins, NavigablePath navigablePath, String explicitSourceAlias, SqlAliasBase explicitSqlAliasBase, Supplier<Consumer<Predicate>> additionalPredicateCollectorAccess, SqlAstCreationState creationState) Create a root TableGroup as defined by this producerdefault TableReferenceJoincreateTableReferenceJoin(String joinTableExpression, SqlAliasBase sqlAliasBase, TableReference lhs, SqlAstCreationState creationState) default Object[]extractConcreteTypeStateValues(Map<AttributeMapping, DomainResultAssembler> assemblerMapping, RowProcessingState rowProcessingState) Deprecated, for removal: This API element is subject to removal in a future version.default EntityMappingTypeFind an attribute-mapping, declared on this entity mapping (not super or subs), by namedefault ModelPartfindSubPart(String name) default ModelPartfindSubTypesSubPart(String name, EntityMappingType treatTargetType) default voidforEachAttributeMapping(Consumer<? super AttributeMapping> action) Visit each attribute mappingdefault AttributeMappinggetAttributeMapping(int position) Retrieve an attribute mapping by position, relative to all attributesdefault AttributeMappingsListThe attributes mapping for this entity, including those declared on supertype mappingsdefault StringDeprecated.Get access to the attributes defined on this class - do not access attributes defined on the superMapping details for the entity's discriminator.default StringThe discriminator value which indicates this entity mappingThe entity name.Safety-net.default FetchablegetFetchable(int position) Mapping details for the entity's identifier.default EntityIdentifierMappingMapping details for the entity's identifier.Details for the table that defines the identifier column(s) for an entity hierarchy.default Stringdefault JavaType<?> The Java type for this part.default intThe number of JDBC mappingsdefault JavaType<?> The descriptor descriptor for the mapped Java typedefault StringGet the name of the entity that is the "super class" for this entityDetails for the table this entity maps.Access to performing multi-value natural-id database selection.Access to performing natural-id database selection.The mapping for the natural-id of the entity, if one is defineddefault intThe total number of attributes for this entity, including those declared on supertype mappingsdefault intGet the number of attributes defined on this entity mapping - do not access attributes defined on the superdefault intThe number of fetchables in the containerdefault MappingTypeThe type for this part.default StringThe local part name, which is generally the unqualified role namedefault EntityRepresentationStrategyDescribes how the entity is represented in the application's domain model.default EntityMappingTypedefault StringThe name for this loadable, for use as the root when generating relative pathsThe mapping for the row-id of the entity, if one is defined.default SoftDeleteMappingMapping for soft-delete support, ornullif soft-delete not defineddefault TableDetailsDetails about the table which holds the soft-delete column.default StringGet the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generateddefault SqmMultiTableInsertStrategydefault SqmMultiTableMutationStrategydefault intA value that uniquely identifies an entity mapping relative to its inheritance hierarchydefault Collection<EntityMappingType> Retrieve mappings for all subtypesdefault EntityMappingTypeThe mapping for the entity which is the supertype for this entity mapping.Mapping details for the entity's version when using the version strategy.default booleanWhether this entity mapping has any subtype mappingsdefault booleanDoes this restrictable have a where restriction?default booleanWhether this entity is defined as abstract using the Javaabstractkeyworddefault booleanisAffectedByEnabledFetchProfiles(LoadQueryInfluencers influencers) Whether any of the LoadQueryInfluencers.getEnabledFetchProfileNames() apply to this loadabledefault booleanisAffectedByEnabledFilters(LoadQueryInfluencers influencers, boolean onlyApplyForLoadByKeyFilters) Whether any of the "influencers" affect this loadable.default booleanisAffectedByEntityGraph(LoadQueryInfluencers influencers) Whether the effective entity-graph applies to this loadabledefault booleanReturnstrueif this entity type's hierarchy is configured to return concrete-typed proxies.booleanDeprecated.No longer supporteddefault booleanisTypeOrSuperType(EntityMappingType targetType) Whether the passed entity mapping is the same as or is a supertype of this entity mappingdefault booleanisTypeOrSuperType(ManagedMappingType targetType) Whether the passed mapping is (1) an entity mapping and (2) the same as or a supertype of this entity mappingloadByUniqueKey(String propertyName, Object uniqueKey, SharedSessionContractImplementor session) Load an instance of the persistent class, by a unique key other than the primary key.default OptimisticLockStyleThe type of optimistic locking, if any, defined for this entity mappingdefault voidpruneForSubclasses(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.default EntityMappingTypeIf this entity is configured to return concrete-typed proxies, this method queries the entity table(s) do determine the concrete entity type associated with the provided id and returns its persister.default voidvisitAttributeMappings(Consumer<? super AttributeMapping> action) Visit the mappings, but limited to just attributes defined in the targetType or its super-type(s) if any.voidvoidvisitDeclaredAttributeMappings(Consumer<? super AttributeMapping> action) Visit attributes defined on this class - do not visit attributes defined on the supervoidvisitQuerySpaces(Consumer<String> querySpaceConsumer) Visit each "query space" for the mapped entity.default voidvisitSubTypeAttributeMappings(Consumer<? super AttributeMapping> action) Walk this type's attributes as well as its subtypesdefault voidvisitSuperTypeAttributeMappings(Consumer<? super AttributeMapping> action) Walk this type's attributes as well as its super-type'sMethods inherited from interface org.hibernate.metamodel.mapping.Bindable
forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachJdbcValue, forEachJdbcValueMethods inherited from interface org.hibernate.metamodel.mapping.EntityValuedModelPart
addToCacheKey, applySqlSelections, applySqlSelections, createDomainResult, disassemble, findSubPart, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachSubPart, getEntityMappingType, visitSubPartsMethods inherited from interface org.hibernate.sql.results.graph.FetchableContainer
getKeyFetchable, getNumberOfFetchableKeys, getNumberOfKeyFetchables, getSelectableIndex, visitFetchables, visitFetchables, visitFetchables, visitKeyFetchables, visitKeyFetchables, visitKeyFetchablesMethods inherited from interface org.hibernate.metamodel.mapping.FilterRestrictable
applyFilterRestrictionsMethods inherited from interface org.hibernate.metamodel.mapping.JdbcMappingContainer
getJdbcMapping, getSingleJdbcMappingMethods inherited from interface org.hibernate.loader.ast.spi.Loadable
getBatchSize, isAffectedByEnabledFilters, isAffectedByInfluencers, isAffectedByInfluencers, isNotAffectedByInfluencersMethods inherited from interface org.hibernate.metamodel.mapping.ManagedMappingType
anyRequiresAggregateColumnWriter, findAttributeMapping, forEachAttributeMapping, getValue, getValues, hasPartitionedSelectionMapping, isAffectedByEnabledFilters, setValue, setValuesMethods inherited from interface org.hibernate.metamodel.mapping.ModelPart
areEqual, asAttributeMapping, asBasicValuedModelPart, breakDownJdbcValues, breakDownJdbcValues, decompose, decompose, forEachSelectable, forEachSelectable, getNavigableRole, isEntityIdentifierMapping, isVirtualMethods inherited from interface org.hibernate.metamodel.mapping.ModelPartContainer
findByPath, findByPath, forEachSubPartMethods inherited from interface org.hibernate.metamodel.mapping.Restrictable
applyBaseRestrictionsMethods inherited from interface org.hibernate.sql.ast.tree.from.TableGroupProducer
containsTableReference
-
Method Details
-
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
Describes how the entity is represented in the application's domain model. -
getMappedTableDetails
TableDetails getMappedTableDetails()Details for the table this entity maps. Generally this is the same asgetIdentifierTableDetails(), though may be different for subtypes in joined andunion inheritance hierarchies- See Also:
-
getIdentifierTableDetails
TableDetails getIdentifierTableDetails()Details for the table that defines the identifier column(s) for an entity hierarchy. -
findContainingEntityMapping
- Specified by:
findContainingEntityMappingin interfaceModelPart
-
getJavaType
Description copied from interface:ModelPartThe Java type for this part. Generally equivalent toMappingType.getMappedJavaType()relative toModelPart.getPartMappingType()- Specified by:
getJavaTypein interfaceManagedMappingType- Specified by:
getJavaTypein interfaceModelPart
-
asEntityMappingType
- Specified by:
asEntityMappingTypein interfaceModelPart
-
getPartMappingType
Description copied from interface:ModelPartThe type for this part.- Specified by:
getPartMappingTypein interfaceManagedMappingType- Specified by:
getPartMappingTypein interfaceModelPart
-
visitQuerySpaces
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.
-
findSubPart
- Specified by:
findSubPartin interfaceEntityValuedModelPart
-
findSubTypesSubPart
-
getJdbcTypeCount
default int getJdbcTypeCount()Description copied from interface:BindableThe number of JDBC mappings- Specified by:
getJdbcTypeCountin interfaceBindable- Specified by:
getJdbcTypeCountin interfaceEntityValuedModelPart- Specified by:
getJdbcTypeCountin interfaceJdbcMappingContainer
-
isAbstract
default boolean isAbstract()Whether this entity is defined as abstract using the Javaabstractkeyword -
hasSubclasses
default boolean hasSubclasses()Whether this entity mapping has any subtype mappings -
getSuperMappingType
The mapping for the entity which is the supertype for this entity mapping.- Returns:
- The supertype mapping, or
nullif there is no supertype - API Note:
- This need not be the direct superclass of the entity as it is driven by mapping.
-
getMappedSuperclass
Get the name of the entity that is the "super class" for this entity- See Also:
-
getSubMappingTypes
Retrieve mappings for all subtypes -
isTypeOrSuperType
Whether the passed entity mapping is the same as or is a supertype of this entity mapping -
isTypeOrSuperType
Whether the passed mapping is (1) an entity mapping and (2) the same as or a supertype of this entity mapping- See Also:
-
getSubclassId
default int getSubclassId()A value that uniquely identifies an entity mapping relative to its inheritance hierarchy -
getSubclassEntityNames
-
isExplicitPolymorphism
Deprecated.No longer supportedIs this class explicit polymorphism only? -
getDiscriminatorValue
Object getDiscriminatorValue()The discriminator value which indicates this entity mapping -
getDiscriminatorSQLValue
-
getRootEntityDescriptor
-
pruneForSubclasses
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
treatedEntityNamesonly containsSub1or any of its subtypes, this means thatSub2and 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 forentityNameUses- The entity names under which a table group was used.
-
getIdentifierMapping
EntityIdentifierMapping getIdentifierMapping()Mapping details for the entity's identifier. This is shared across all entity mappings within an inheritance hierarchy. -
getIdentifierMappingForJoin
Mapping details for the entity's identifier. This is shared across all entity mappings within an inheritance hierarchy. -
getDiscriminatorMapping
EntityDiscriminatorMapping getDiscriminatorMapping()Mapping details for the entity's discriminator. This is shared across all entity mappings within an inheritance hierarchy.- Specified by:
getDiscriminatorMappingin interfaceDiscriminable
-
isConcreteProxy
Returnstrueif this entity type's hierarchy is configured to return concrete-typed proxies.- Since:
- 6.6
- See Also:
-
getVersionMapping
EntityVersionMapping getVersionMapping()Mapping details for the entity's version when using the version strategy. This is shared across all entity mappings within an inheritance hierarchy.- Returns:
- The version mapping, or null if the entity is (1) defined
with a strategy other than
OptimisticLockStyle.VERSIONor (2) defined without optimistic locking - See Also:
-
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. -
getSoftDeleteMapping
Mapping for soft-delete support, ornullif soft-delete not defined- Specified by:
getSoftDeleteMappingin interfaceSoftDeletableModelPart
-
getSoftDeleteTableDetails
Description copied from interface:SoftDeletableModelPartDetails about the table which holds the soft-delete column.- Specified by:
getSoftDeleteTableDetailsin interfaceSoftDeletableModelPart
-
getNumberOfAttributeMappings
default int getNumberOfAttributeMappings()The total number of attributes for this entity, including those declared on supertype mappings- Specified by:
getNumberOfAttributeMappingsin interfaceManagedMappingType
-
getAttributeMappings
The attributes mapping for this entity, including those declared on supertype mappings- Specified by:
getAttributeMappingsin interfaceManagedMappingType
-
forEachAttributeMapping
Visit each attribute mapping- Specified by:
forEachAttributeMappingin interfaceManagedMappingType- See Also:
-
getAttributeMapping
Retrieve an attribute mapping by position, relative to all attributes- Specified by:
getAttributeMappingin interfaceManagedMappingType
-
findDeclaredAttributeMapping
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
Visit attributes defined on this class - do not visit attributes defined on the super -
visitAttributeMappings
Visit the mappings, but limited to just attributes defined in the targetType or its super-type(s) if any. -
visitSubTypeAttributeMappings
Walk this type's attributes as well as its subtypes -
visitSuperTypeAttributeMappings
Walk this type's attributes as well as its super-type's -
visitConstraintOrderedTables
-
getImportedName
-
extractConcreteTypeStateValues
@Deprecated(forRemoval=true) default Object[] extractConcreteTypeStateValues(Map<AttributeMapping, DomainResultAssembler> assemblerMapping, RowProcessingState rowProcessingState) Deprecated, for removal: This API element is subject to removal in a future version. -
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 -
isAffectedByEnabledFilters
default boolean isAffectedByEnabledFilters(LoadQueryInfluencers influencers, boolean onlyApplyForLoadByKeyFilters) Description copied from interface:LoadableWhether any of the "influencers" affect this loadable.- Specified by:
isAffectedByEnabledFiltersin interfaceLoadable
-
isAffectedByEntityGraph
Description copied from interface:LoadableWhether the effective entity-graph applies to this loadable- Specified by:
isAffectedByEntityGraphin interfaceLoadable
-
isAffectedByEnabledFetchProfiles
Description copied from interface:LoadableWhether any of the LoadQueryInfluencers.getEnabledFetchProfileNames() apply to this loadable- Specified by:
isAffectedByEnabledFetchProfilesin interfaceLoadable
-
getSqmMultiTableMutationStrategy
-
getSqmMultiTableInsertStrategy
-
getSqlAliasStem
Description copied from interface:TableGroupProducerGet the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generatedNote that this is a metadata-ive value. It is only ever used internal to the producer producing its TableGroup.
- Specified by:
getSqlAliasStemin interfaceTableGroupProducer- See Also:
-
createPrimaryTableReference
default TableReference createPrimaryTableReference(SqlAliasBase sqlAliasBase, SqlAstCreationState creationState) -
createTableReferenceJoin
default TableReferenceJoin createTableReferenceJoin(String joinTableExpression, SqlAliasBase sqlAliasBase, TableReference lhs, SqlAstCreationState creationState) -
getMappedJavaType
Description copied from interface:MappingTypeThe descriptor descriptor for the mapped Java type- Specified by:
getMappedJavaTypein interfaceMappingType
-
getNumberOfFetchables
default int getNumberOfFetchables()Description copied from interface:FetchableContainerThe number of fetchables in the container- Specified by:
getNumberOfFetchablesin interfaceFetchableContainer
-
getFetchable
- Specified by:
getFetchablein interfaceFetchableContainer
-
applyDiscriminator
default void applyDiscriminator(Consumer<Predicate> predicateConsumer, String alias, TableGroup tableGroup, SqlAstCreationState creationState) Description copied from interface:DiscriminableApply the discriminator as a predicate via thepredicateConsumer- Specified by:
applyDiscriminatorin interfaceDiscriminable
-
applyFilterRestrictions
default void applyFilterRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String, Filter> enabledFilters, boolean onlyApplyLoadByKeyFilters, SqlAstCreationState creationState) Description copied from interface:FilterRestrictableApplies just theFiltervalues enabled for the associated entity- Specified by:
applyFilterRestrictionsin interfaceFilterRestrictable
-
applyBaseRestrictions
default void applyBaseRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, Map<String, Filter> enabledFilters, boolean onlyApplyLoadByKeyFilters, Set<String> treatAsDeclarations, SqlAstCreationState creationState) Description copied from interface:RestrictableApplies the base set of restrictions.- Specified by:
applyBaseRestrictionsin interfaceRestrictable
-
hasWhereRestrictions
default boolean hasWhereRestrictions()Description copied from interface:WhereRestrictableDoes this restrictable have a where restriction?- Specified by:
hasWhereRestrictionsin interfaceWhereRestrictable
-
applyWhereRestrictions
default void applyWhereRestrictions(Consumer<Predicate> predicateConsumer, TableGroup tableGroup, boolean useQualifier, SqlAstCreationState creationState) Description copied from interface:WhereRestrictableApply theSQLRestrictionrestrictions- Specified by:
applyWhereRestrictionsin interfaceWhereRestrictable
-
getEntityPersister
Safety-net. -
getContributor
Deprecated. -
getPartName
Description copied from interface:ModelPartThe local part name, which is generally the unqualified role name- Specified by:
getPartNamein interfaceModelPart
-
getRootPathName
Description copied from interface:LoadableThe name for this loadable, for use as the root when generating relative paths- Specified by:
getRootPathNamein interfaceLoadable
-
Contributable.getContributor()