Class OneToManyCollectionPart
- java.lang.Object
-
- org.hibernate.metamodel.mapping.internal.AbstractEntityCollectionPart
-
- org.hibernate.metamodel.mapping.internal.OneToManyCollectionPart
-
- All Implemented Interfaces:
Bindable
,CollectionPart
,EntityValuedModelPart
,EntityCollectionPart
,JdbcMappingContainer
,MappingModelExpressible
,ModelPart
,ModelPartContainer
,SelectableMappings
,ValuedModelPart
,ValueMapping
,TableGroupJoinProducer
,TableGroupProducer
,EntityValuedFetchable
,Fetchable
,FetchableContainer
,FetchOptions
,FetchStyleAccess
,FetchTimingAccess
,JavaTypedExpressible
public class OneToManyCollectionPart extends AbstractEntityCollectionPart implements TableGroupJoinProducer
order( id, ... ) item( id, order_fk, ... ) `Order#items` table : item key : order_fk element : id
-
-
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.internal.EntityCollectionPart
EntityCollectionPart.Cardinality
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.ModelPart
ModelPart.IndexedJdbcValueConsumer, ModelPart.JdbcValueConsumer
-
-
Constructor Summary
Constructors Constructor Description OneToManyCollectionPart(CollectionPart.Nature nature, Collection bootCollectionDescriptor, CollectionPersister collectionDescriptor, EntityMappingType elementTypeDescriptor, NotFoundAction notFoundAction, MappingModelCreationProcess creationProcess)
OneToManyCollectionPart(CollectionPart.Nature nature, Collection bootCollectionDescriptor, CollectionPersister collectionDescriptor, EntityMappingType elementTypeDescriptor, MappingModelCreationProcess creationProcess)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
breakDownJdbcValues(Object domainValue, ModelPart.JdbcValueConsumer valueConsumer, SharedSessionContractImplementor session)
TableGroup
createAssociatedTableGroup(boolean canUseInnerJoins, NavigablePath append, boolean fetched, String sourceAlias, SqlAliasBase sqlAliasBase, SqlExpressionResolver sqlExpressionResolver, SqlAstCreationContext creationContext)
TableGroup
createRootTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, String explicitSourceAlias, SqlAstJoinType sqlAstJoinType, 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.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.Object
disassemble(Object value, SharedSessionContractImplementor session)
boolean
finishInitialization(CollectionPersister collectionDescriptor, Collection bootValueMapping, String fkTargetModelPartName, MappingModelCreationProcess creationProcess)
Perform any delayed initialization.int
forEachSelectable(int offset, SelectableConsumer consumer)
Visit each contained selectable mapping.EntityCollectionPart.Cardinality
getCardinality()
String
getContainingTableExpression()
The table which contains the columns mapped by this valueSqlAstJoinType
getDefaultSqlAstJoinType(TableGroup parentTableGroup)
SelectableMapping
getSelectable(int columnIndex)
Get the selectable at the given positionboolean
hasPartitionedSelectionMapping()
boolean
isSimpleJoinPredicate(Predicate predicate)
Returns whether the given predicate is a simple join predicate for this attribute.protected AssociationKey
resolveFetchAssociationKey()
-
Methods inherited from class org.hibernate.metamodel.mapping.internal.AbstractEntityCollectionPart
containsTableReference, createDomainResult, createTableGroupInternal, findContainingEntityMapping, generateFetch, getAssociatedEntityMappingType, getCollectionDescriptor, getFetchableKey, getFetchableName, getMappedFetchOptions, getMappedType, getNature, getNavigableRole, getNotFoundAction, getNumberOfFetchables, getSqlAliasStem, getStyle, getTargetKeyPropertyNames, getTiming, incrementFetchDepth, isOptional, isUnwrapProxy, 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
-
Methods inherited from interface org.hibernate.metamodel.mapping.CollectionPart
getInclusionCheckPart, getPartName
-
Methods inherited from interface org.hibernate.metamodel.mapping.internal.EntityCollectionPart
getEntityMappingType, getExpressibleJavaType, getJavaType, getJdbcTypeCount, getPartMappingType
-
Methods inherited from interface org.hibernate.metamodel.mapping.EntityValuedModelPart
applySqlSelections, applySqlSelections, findSubPart, findSubPart, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachSubPart, visitSubParts
-
Methods inherited from interface org.hibernate.sql.results.graph.Fetchable
asAttributeMapping, resolveCircularFetch
-
Methods inherited from interface org.hibernate.sql.results.graph.FetchableContainer
getFetchable, getKeyFetchable, getNumberOfFetchableKeys, getNumberOfKeyFetchables, getSelectableIndex, visitFetchables, visitFetchables, visitFetchables, visitKeyFetchables, visitKeyFetchables, visitKeyFetchables
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPart
areEqual, decompose, findContainingEntityMapping, getNavigableRole, isVirtual
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPartContainer
findByPath, forEachSubPart
-
Methods inherited from interface org.hibernate.sql.ast.tree.from.TableGroupJoinProducer
createRootTableGroupJoin, createTableGroupJoin
-
Methods inherited from interface org.hibernate.sql.ast.tree.from.TableGroupProducer
containsTableReference, getSqlAliasStem
-
Methods inherited from interface org.hibernate.metamodel.mapping.ValuedModelPart
forEachInsertable, forEachSelectable, forEachUpdatable, getJdbcMappings
-
Methods inherited from interface org.hibernate.metamodel.mapping.ValueMapping
treatAs
-
-
-
-
Constructor Detail
-
OneToManyCollectionPart
public OneToManyCollectionPart(CollectionPart.Nature nature, Collection bootCollectionDescriptor, CollectionPersister collectionDescriptor, EntityMappingType elementTypeDescriptor, MappingModelCreationProcess creationProcess)
-
OneToManyCollectionPart
public OneToManyCollectionPart(CollectionPart.Nature nature, Collection bootCollectionDescriptor, CollectionPersister collectionDescriptor, EntityMappingType elementTypeDescriptor, NotFoundAction notFoundAction, MappingModelCreationProcess creationProcess)
-
-
Method Detail
-
getCardinality
public EntityCollectionPart.Cardinality getCardinality()
- Specified by:
getCardinality
in interfaceEntityCollectionPart
-
breakDownJdbcValues
public void breakDownJdbcValues(Object domainValue, ModelPart.JdbcValueConsumer valueConsumer, SharedSessionContractImplementor session)
- Specified by:
breakDownJdbcValues
in interfaceModelPart
-
disassemble
public Object disassemble(Object value, SharedSessionContractImplementor session)
- Specified by:
disassemble
in interfaceBindable
- Specified by:
disassemble
in interfaceEntityValuedModelPart
- See Also:
As an example, consider the following domain model: ````
-
getContainingTableExpression
public String getContainingTableExpression()
Description copied from interface:ValuedModelPart
The table which contains the columns mapped by this value- Specified by:
getContainingTableExpression
in interfaceValuedModelPart
-
getSelectable
public SelectableMapping getSelectable(int columnIndex)
Description copied from interface:SelectableMappings
Get the selectable at the given position- Specified by:
getSelectable
in interfaceSelectableMappings
-
forEachSelectable
public int forEachSelectable(int offset, SelectableConsumer consumer)
Description copied from interface:SelectableMappings
Visit each contained selectable mapping. As the selectables are iterated, we call `SelectionConsumer` passing along `offset` + our current iteration index. The return is the number of selectables we directly contain- Specified by:
forEachSelectable
in interfaceModelPart
- Specified by:
forEachSelectable
in interfaceSelectableMappings
- Specified by:
forEachSelectable
in interfaceValuedModelPart
- See Also:
SelectableConsumer.accept(int, SelectableMapping)
-
resolveFetchAssociationKey
protected AssociationKey resolveFetchAssociationKey()
- Specified by:
resolveFetchAssociationKey
in classAbstractEntityCollectionPart
-
hasPartitionedSelectionMapping
public boolean hasPartitionedSelectionMapping()
- Specified by:
hasPartitionedSelectionMapping
in interfaceModelPart
-
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
-
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 TableGroup createRootTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, String explicitSourceAlias, SqlAstJoinType sqlAstJoinType, 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
-
createAssociatedTableGroup
public TableGroup createAssociatedTableGroup(boolean canUseInnerJoins, NavigablePath append, boolean fetched, String sourceAlias, SqlAliasBase sqlAliasBase, SqlExpressionResolver sqlExpressionResolver, SqlAstCreationContext creationContext)
-
finishInitialization
public boolean finishInitialization(CollectionPersister collectionDescriptor, Collection bootValueMapping, String fkTargetModelPartName, MappingModelCreationProcess creationProcess)
Description copied from interface:EntityCollectionPart
Perform any delayed initialization.The initialization is considered successful if the result is
true
. It is considered unsuccessful if the result isfalse
or an exception is thrown. Unsuccessful initializations are generally retried "later", to allow waiting for model-parts being available e.g.If the exception is something that will just never succeed, consider throwing an exception with the
NonTransientException
marker to allow the creation process to stop immediately- Specified by:
finishInitialization
in interfaceEntityCollectionPart
-
-