Class EntityCollectionPart
- java.lang.Object
-
- org.hibernate.metamodel.mapping.internal.EntityCollectionPart
-
- All Implemented Interfaces:
Association
,Bindable
,CollectionPart
,EntityAssociationMapping
,EntityValuedModelPart
,JdbcMappingContainer
,MappingModelExpressible
,ModelPart
,ModelPartContainer
,Queryable
,TableGroupJoinProducer
,TableGroupProducer
,EntityValuedFetchable
,Fetchable
,FetchableContainer
,FetchOptions
,FetchStyleAccess
,FetchTimingAccess
,JavaTypedExpressible
public class EntityCollectionPart extends Object implements CollectionPart, EntityAssociationMapping, EntityValuedFetchable, FetchOptions
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.Bindable
Bindable.JdbcValuesConsumer
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.CollectionPart
CollectionPart.Nature
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.ModelPart
ModelPart.JdbcValueConsumer
-
-
Constructor Summary
Constructors Constructor Description EntityCollectionPart(CollectionPersister collectionDescriptor, CollectionPart.Nature nature, Value bootModelValue, NotFoundAction notFoundAction, EntityMappingType entityMappingType, MappingModelCreationProcess creationProcess)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState)
Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.void
applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState, BiConsumer<SqlSelection,JdbcMapping> selectionConsumer)
Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.void
breakDownJdbcValues(Object domainValue, ModelPart.JdbcValueConsumer valueConsumer, SharedSessionContractImplementor session)
boolean
containsTableReference(String tableExpression)
<T> DomainResult<T>
createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState)
Create a DomainResult for a specific reference to this ModelPart.LazyTableGroup
createRootTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, String explicitSourceAlias, SqlAstJoinType requestedJoinType, boolean fetched, Consumer<Predicate> predicateConsumer, SqlAliasBaseGenerator aliasBaseGenerator, SqlExpressionResolver sqlExpressionResolver, FromClauseAccess fromClauseAccess, SqlAstCreationContext creationContext)
Create a TableGroupJoin as defined for this producer, but as root TableGroup.TableGroup
createTableGroupInternal(boolean canUseInnerJoins, NavigablePath navigablePath, boolean fetched, String sourceAlias, SqlAliasBase sqlAliasBase, SqlExpressionResolver sqlExpressionResolver, SqlAstCreationContext creationContext)
TableGroupJoin
createTableGroupJoin(NavigablePath navigablePath, TableGroup collectionTableGroup, String explicitSourceAlias, SqlAstJoinType requestedJoinType, boolean fetched, boolean addsPredicate, SqlAliasBaseGenerator aliasBaseGenerator, SqlExpressionResolver sqlExpressionResolver, FromClauseAccess fromClauseAccess, SqlAstCreationContext creationContext)
Create a TableGroupJoin as defined for this producer The sqlAstJoinType may be null to signal that the join is for an implicit path.EntityMappingType
findContainingEntityMapping()
ModelPart
findSubPart(String name)
ModelPart
findSubPart(String name, EntityMappingType targetType)
For an entity, this form allows for Hibernate's "implicit treat" support - meaning it should find a sub-part whether defined on the entity, its super-type or even one of its sub-types.void
finishInitialization(CollectionPersister collectionDescriptor, Collection bootValueMapping, String fkTargetModelPartName, MappingModelCreationProcess creationProcess)
int
forEachSelectable(int offset, SelectableConsumer consumer)
EntityFetch
generateFetch(FetchParent fetchParent, NavigablePath fetchablePath, FetchTiming fetchTiming, boolean selected, String resultVariable, DomainResultCreationState creationState)
Generates a Fetch of this fetchableEntityMappingType
getAssociatedEntityMappingType()
CollectionPersister
getCollectionDescriptor()
SqlAstJoinType
getDefaultSqlAstJoinType(TableGroup parentTableGroup)
EntityMappingType
getEntityMappingType()
JavaType<?>
getExpressibleJavaType()
Fetchable
getFetchable(int position)
String
getFetchableName()
The name of the fetchableForeignKeyDescriptor
getForeignKeyDescriptor()
The descriptor, allowing access to column(s), etcJavaType<?>
getJavaType()
ModelPart
getKeyTargetMatchPart()
The model sub-part relative to the associated entity type that is the target of this association's foreign-keyString
getMappedBy()
FetchOptions
getMappedFetchOptions()
The configured fetch timing and styleCollectionPart.Nature
getNature()
NavigableRole
getNavigableRole()
int
getNumberOfFetchables()
The number of fetchables in the containerMappingType
getPartMappingType()
ForeignKeyDescriptor.Nature
getSideNature()
Indicates which "side" of the foreign-key this association describesString
getSqlAliasStem()
Get the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generatedFetchStyle
getStyle()
FetchTiming
getTiming()
boolean
incrementFetchDepth()
Should this Fetchable affect the fetch depth? E.g., composites would generally not increment the fetch depth.boolean
isFkOptimizationAllowed()
boolean
isOptional()
boolean
isReferenceToPrimaryKey()
boolean
isSimpleJoinPredicate(Predicate predicate)
Returns whether the given predicate is a simple join predicate for this attribute.boolean
isUnwrapProxy()
String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hibernate.metamodel.mapping.Bindable
forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, getJdbcMappings
-
Methods inherited from interface org.hibernate.metamodel.mapping.CollectionPart
getPartName
-
Methods inherited from interface org.hibernate.metamodel.mapping.EntityValuedModelPart
disassemble, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, getJdbcTypeCount, visitSubParts
-
Methods inherited from interface org.hibernate.sql.results.graph.Fetchable
asAttributeMapping, resolveCircularFetch
-
Methods inherited from interface org.hibernate.sql.results.graph.FetchableContainer
getKeyFetchable, getNumberOfKeyFetchables, visitFetchables, visitFetchables, visitFetchables, visitKeyFetchables, visitKeyFetchables, visitKeyFetchables
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPart
areEqual, forEachSelectable
-
Methods inherited from interface org.hibernate.metamodel.mapping.Queryable
findByPath, findSubTypesSubPart, resolveSubPart
-
Methods inherited from interface org.hibernate.sql.ast.tree.from.TableGroupJoinProducer
createRootTableGroupJoin, createTableGroupJoin
-
-
-
-
Constructor Detail
-
EntityCollectionPart
public EntityCollectionPart(CollectionPersister collectionDescriptor, CollectionPart.Nature nature, Value bootModelValue, NotFoundAction notFoundAction, EntityMappingType entityMappingType, MappingModelCreationProcess creationProcess)
-
-
Method Detail
-
finishInitialization
public void finishInitialization(CollectionPersister collectionDescriptor, Collection bootValueMapping, String fkTargetModelPartName, MappingModelCreationProcess creationProcess)
-
getDefaultSqlAstJoinType
public SqlAstJoinType getDefaultSqlAstJoinType(TableGroup parentTableGroup)
- Specified by:
getDefaultSqlAstJoinType
in interfaceTableGroupJoinProducer
-
isSimpleJoinPredicate
public boolean isSimpleJoinPredicate(Predicate predicate)
Description copied from interface:TableGroupJoinProducer
Returns whether the given predicate is a simple join predicate for this attribute. This is useful to understand if a predicate has additional conjunctions other than the FK related predicate.- Specified by:
isSimpleJoinPredicate
in interfaceTableGroupJoinProducer
-
getNature
public CollectionPart.Nature getNature()
- Specified by:
getNature
in interfaceCollectionPart
-
getPartMappingType
public MappingType getPartMappingType()
- Specified by:
getPartMappingType
in interfaceModelPart
-
getEntityMappingType
public EntityMappingType getEntityMappingType()
- Specified by:
getEntityMappingType
in interfaceEntityValuedModelPart
-
getAssociatedEntityMappingType
public EntityMappingType getAssociatedEntityMappingType()
- Specified by:
getAssociatedEntityMappingType
in interfaceEntityAssociationMapping
-
getKeyTargetMatchPart
public ModelPart getKeyTargetMatchPart()
Description copied from interface:EntityAssociationMapping
The model sub-part relative to the associated entity type that is the target of this association's foreign-key- Specified by:
getKeyTargetMatchPart
in interfaceEntityAssociationMapping
-
getJavaType
public JavaType<?> getJavaType()
- Specified by:
getJavaType
in interfaceModelPart
-
getExpressibleJavaType
public JavaType<?> getExpressibleJavaType()
- Specified by:
getExpressibleJavaType
in interfaceJavaTypedExpressible
-
getNavigableRole
public NavigableRole getNavigableRole()
- Specified by:
getNavigableRole
in interfaceModelPart
- See Also:
ModelPart.getPartName()
-
getFetchableName
public String getFetchableName()
Description copied from interface:Fetchable
The name of the fetchable- Specified by:
getFetchableName
in interfaceEntityAssociationMapping
- Specified by:
getFetchableName
in interfaceFetchable
-
getMappedFetchOptions
public FetchOptions getMappedFetchOptions()
Description copied from interface:Fetchable
The configured fetch timing and style- Specified by:
getMappedFetchOptions
in interfaceFetchable
-
incrementFetchDepth
public boolean incrementFetchDepth()
Description copied from interface:Fetchable
Should this Fetchable affect the fetch depth? E.g., composites would generally not increment the fetch depth.- Specified by:
incrementFetchDepth
in interfaceEntityAssociationMapping
- Specified by:
incrementFetchDepth
in interfaceFetchable
- See Also:
AvailableSettings.MAX_FETCH_DEPTH
-
findSubPart
public ModelPart findSubPart(String name)
- Specified by:
findSubPart
in interfaceEntityValuedModelPart
-
findSubPart
public ModelPart findSubPart(String name, EntityMappingType targetType)
Description copied from interface:Queryable
For an entity, this form allows for Hibernate's "implicit treat" support - meaning it should find a sub-part whether defined on the entity, its super-type or even one of its sub-types.- Specified by:
findSubPart
in interfaceEntityValuedModelPart
- Specified by:
findSubPart
in interfaceQueryable
-
isOptional
public boolean isOptional()
- Specified by:
isOptional
in interfaceEntityValuedFetchable
-
isUnwrapProxy
public boolean isUnwrapProxy()
- Specified by:
isUnwrapProxy
in interfaceEntityValuedFetchable
-
createDomainResult
public <T> DomainResult<T> createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState)
Description copied from interface:ModelPart
Create a DomainResult for a specific reference to this ModelPart.- Specified by:
createDomainResult
in interfaceEntityValuedModelPart
- Specified by:
createDomainResult
in interfaceModelPart
-
generateFetch
public EntityFetch generateFetch(FetchParent fetchParent, NavigablePath fetchablePath, FetchTiming fetchTiming, boolean selected, String resultVariable, DomainResultCreationState creationState)
Description copied from interface:Fetchable
Generates a Fetch of this fetchable- Specified by:
generateFetch
in interfaceEntityValuedFetchable
- Specified by:
generateFetch
in interfaceFetchable
- Parameters:
fetchParent
- The parent of the Fetch we are generatingfetchablePath
- The overall path within the graphfetchTiming
- The requested fetch timing
-
forEachSelectable
public int forEachSelectable(int offset, SelectableConsumer consumer)
- Specified by:
forEachSelectable
in interfaceModelPart
-
breakDownJdbcValues
public void breakDownJdbcValues(Object domainValue, ModelPart.JdbcValueConsumer valueConsumer, SharedSessionContractImplementor session)
- Specified by:
breakDownJdbcValues
in interfaceModelPart
-
applySqlSelections
public void applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState)
Description copied from interface:ModelPart
Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.- Specified by:
applySqlSelections
in interfaceEntityValuedModelPart
- Specified by:
applySqlSelections
in interfaceModelPart
-
applySqlSelections
public void applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState, BiConsumer<SqlSelection,JdbcMapping> selectionConsumer)
Description copied from interface:ModelPart
Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.- Specified by:
applySqlSelections
in interfaceEntityValuedModelPart
- Specified by:
applySqlSelections
in interfaceModelPart
-
findContainingEntityMapping
public EntityMappingType findContainingEntityMapping()
- Specified by:
findContainingEntityMapping
in interfaceModelPart
-
getNumberOfFetchables
public int getNumberOfFetchables()
Description copied from interface:FetchableContainer
The number of fetchables in the container- Specified by:
getNumberOfFetchables
in interfaceFetchableContainer
-
getFetchable
public Fetchable getFetchable(int position)
- Specified by:
getFetchable
in interfaceFetchableContainer
-
getMappedBy
public String getMappedBy()
-
getForeignKeyDescriptor
public ForeignKeyDescriptor getForeignKeyDescriptor()
Description copied from interface:Association
The descriptor, allowing access to column(s), etc- Specified by:
getForeignKeyDescriptor
in interfaceAssociation
-
getSideNature
public ForeignKeyDescriptor.Nature getSideNature()
Description copied from interface:Association
Indicates which "side" of the foreign-key this association describes- Specified by:
getSideNature
in interfaceAssociation
-
isReferenceToPrimaryKey
public boolean isReferenceToPrimaryKey()
- Specified by:
isReferenceToPrimaryKey
in interfaceEntityAssociationMapping
-
isFkOptimizationAllowed
public boolean isFkOptimizationAllowed()
- Specified by:
isFkOptimizationAllowed
in interfaceEntityAssociationMapping
-
getCollectionDescriptor
public CollectionPersister getCollectionDescriptor()
-
getStyle
public FetchStyle getStyle()
- Specified by:
getStyle
in interfaceFetchStyleAccess
-
getTiming
public FetchTiming getTiming()
- Specified by:
getTiming
in interfaceFetchTimingAccess
-
createTableGroupJoin
public TableGroupJoin createTableGroupJoin(NavigablePath navigablePath, TableGroup collectionTableGroup, String explicitSourceAlias, SqlAstJoinType requestedJoinType, boolean fetched, boolean addsPredicate, SqlAliasBaseGenerator aliasBaseGenerator, SqlExpressionResolver sqlExpressionResolver, FromClauseAccess fromClauseAccess, SqlAstCreationContext creationContext)
Description copied from interface:TableGroupJoinProducer
Create a TableGroupJoin as defined for this producer The sqlAstJoinType may be null to signal that the join is for an implicit path. When addsPredicate istrue
, the SQM join for the attribute contains an explicitON
clause, and isfalse
otherwise.- Specified by:
createTableGroupJoin
in interfaceTableGroupJoinProducer
-
createRootTableGroupJoin
public LazyTableGroup createRootTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, String explicitSourceAlias, SqlAstJoinType requestedJoinType, boolean fetched, Consumer<Predicate> predicateConsumer, SqlAliasBaseGenerator aliasBaseGenerator, SqlExpressionResolver sqlExpressionResolver, FromClauseAccess fromClauseAccess, SqlAstCreationContext creationContext)
Description copied from interface:TableGroupJoinProducer
Create a TableGroupJoin as defined for this producer, but as root TableGroup. The main purpose of this is for correlating an association in a subquery i.e. `... alias where exists (select 1 from SomeEntity e where alias.association.attr = 1)`. The sqlAstJoinType may be null to signal that the join is for an implicit path.- Specified by:
createRootTableGroupJoin
in interfaceTableGroupJoinProducer
-
createTableGroupInternal
public TableGroup createTableGroupInternal(boolean canUseInnerJoins, NavigablePath navigablePath, boolean fetched, String sourceAlias, SqlAliasBase sqlAliasBase, SqlExpressionResolver sqlExpressionResolver, SqlAstCreationContext creationContext)
-
getSqlAliasStem
public String getSqlAliasStem()
Description copied from interface:TableGroupProducer
Get the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generated Note that this is a metadata-ive value. It is only ever used internal to the producer producing its TableGroup.- Specified by:
getSqlAliasStem
in interfaceTableGroupProducer
- See Also:
SqlAliasBaseManager.createSqlAliasBase(java.lang.String)
-
containsTableReference
public boolean containsTableReference(String tableExpression)
- Specified by:
containsTableReference
in interfaceTableGroupProducer
-
-