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.JdbcValuesBiConsumer<X,Y>, 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.JdbcValueBiConsumer<X,Y>, ModelPart.JdbcValueConsumer
-
-
Field Summary
-
Fields inherited from class org.hibernate.metamodel.mapping.internal.AbstractEntityCollectionPart
targetKeyPropertyNames
-
-
Constructor Summary
Constructors Modifier 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)
protected
OneToManyCollectionPart(OneToManyCollectionPart original)
For Hibernate Reactive
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <X,Y>
intbreakDownJdbcValues(Object domainValue, int offset, X x, Y y, ModelPart.JdbcValueBiConsumer<X,Y> valueConsumer, SharedSessionContractImplementor session)
Breaks down the domain value to its constituent JDBC values.boolean
containsTableReference(String tableExpression)
TableGroup
createAssociatedTableGroup(boolean canUseInnerJoins, NavigablePath append, boolean fetched, String sourceAlias, SqlAliasBase sqlAliasBase, SqlAstCreationState creationState)
TableGroup
createRootTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, @Nullable String explicitSourceAlias, @Nullable SqlAliasBase explicitSqlAliasBase, @Nullable SqlAstJoinType sqlAstJoinType, boolean fetched, @Nullable Consumer<Predicate> predicateConsumer, SqlAstCreationState creationState)
Create the "join", but return a TableGroup.TableGroupJoin
createTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, @Nullable String explicitSourceAlias, @Nullable SqlAliasBase explicitSqlAliasBase, @Nullable SqlAstJoinType requestedJoinType, boolean fetched, boolean addsPredicate, SqlAstCreationState creationState)
Create a TableGroupJoin.boolean
finishInitialization(CollectionPersister collectionDescriptor, Collection bootValueMapping, String fkTargetModelPartName, MappingModelCreationProcess creationProcess)
Perform any delayed initialization.int
forEachSelectable(int offset, SelectableConsumer consumer)
Visits each selectable mapping with the selectable index offset by the given value.EntityCollectionPart.Cardinality
getCardinality()
String
getContainingTableExpression()
The table which contains the columns mapped by this valueSqlAstJoinType
getDefaultSqlAstJoinType(TableGroup parentTableGroup)
JdbcMapping
getJdbcMapping(int index)
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
buildEagerCollectionFetch, buildEntityFetchJoined, createDomainResult, createTableGroupInternal, disassemble, findContainingEntityMapping, generateFetch, getAssociatedEntityMappingType, getCollectionAttribute, getCollectionDescriptor, getFetchableKey, getFetchableName, getMappedFetchOptions, getMappedType, getNature, getNavigableRole, getNotFoundAction, getNumberOfFetchables, getSqlAliasStem, getStyle, 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, forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachJdbcValue, forEachJdbcValue
-
Methods inherited from interface org.hibernate.metamodel.mapping.CollectionPart
getInclusionCheckPart, getPartName
-
Methods inherited from interface org.hibernate.metamodel.mapping.internal.EntityCollectionPart
addToCacheKey, 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, isSelectable, 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, asBasicValuedModelPart, asEntityMappingType, breakDownJdbcValues, decompose, decompose, findContainingEntityMapping, getNavigableRole, isEntityIdentifierMapping, isVirtual
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPartContainer
findByPath, findByPath, forEachSubPart
-
Methods inherited from interface org.hibernate.sql.ast.tree.from.TableGroupJoinProducer
determineSqlJoinType
-
Methods inherited from interface org.hibernate.sql.ast.tree.from.TableGroupProducer
getSqlAliasStem
-
Methods inherited from interface org.hibernate.metamodel.mapping.ValuedModelPart
forEachInsertable, forEachNonFormula, forEachSelectable, forEachUpdatable, getSingleJdbcMapping
-
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)
-
OneToManyCollectionPart
protected OneToManyCollectionPart(OneToManyCollectionPart original)
For Hibernate Reactive
-
-
Method Detail
-
getCardinality
public EntityCollectionPart.Cardinality getCardinality()
- Specified by:
getCardinality
in interfaceEntityCollectionPart
-
breakDownJdbcValues
public <X,Y> int breakDownJdbcValues(Object domainValue, int offset, X x, Y y, ModelPart.JdbcValueBiConsumer<X,Y> valueConsumer, SharedSessionContractImplementor session)
Description copied from interface:ModelPart
Breaks down the domain value to its constituent JDBC values. Think of it as breaking the multi-dimensional array into a visitable flat array. Additionally, it passes through the valuesX
andY
to the consumer. Returns the amount of jdbc types that have been visited.- Specified by:
breakDownJdbcValues
in interfaceModelPart
-
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:ModelPart
Visits each selectable mapping with the selectable index offset by the given value. Returns the amount of jdbc types that have been visited.- 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
-
containsTableReference
public boolean containsTableReference(String tableExpression)
- Specified by:
containsTableReference
in interfaceTableGroupProducer
- Overrides:
containsTableReference
in classAbstractEntityCollectionPart
-
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 lhs, @Nullable String explicitSourceAlias, @Nullable SqlAliasBase explicitSqlAliasBase, @Nullable SqlAstJoinType requestedJoinType, boolean fetched, boolean addsPredicate, SqlAstCreationState creationState)
Description copied from interface:TableGroupJoinProducer
Create a TableGroupJoin.- Specified by:
createTableGroupJoin
in interfaceTableGroupJoinProducer
- Parameters:
navigablePath
- The NavigablePath to the joinlhs
- The join's (L)eft-(H)and (S)ideexplicitSqlAliasBase
- A specific SqlAliasBase to use. May benull
indicating one should be created using the SqlAliasBaseGenerator fromcreationState
requestedJoinType
- An explicit join-type. May be null to signal that the join is for an implicit path.addsPredicate
- Indicates there are explicit, additional predicates (from an SQM tree ON/WITH clause)
-
createRootTableGroupJoin
public TableGroup createRootTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, @Nullable String explicitSourceAlias, @Nullable SqlAliasBase explicitSqlAliasBase, @Nullable SqlAstJoinType sqlAstJoinType, boolean fetched, @Nullable Consumer<Predicate> predicateConsumer, SqlAstCreationState creationState)
Description copied from interface:TableGroupJoinProducer
Create the "join", but return a TableGroup. Intended for creating sub-query correlations. E.g., givenfrom SomeEntity e where exists ( select 1 from AnotherEntity a where e.association.attr = 1 )
We call this for the `e.association` path.- Specified by:
createRootTableGroupJoin
in interfaceTableGroupJoinProducer
- Parameters:
navigablePath
- The NavigablePath to the joinlhs
- The join's (L)eft-(H)and (S)ideexplicitSqlAliasBase
- A specific SqlAliasBase to use. May benull
indicating one should be created using the SqlAliasBaseGenerator fromcreationState
sqlAstJoinType
- An explicit join-type. May be null to signal that the join is for an implicit path.predicateConsumer
- Consumer for additional predicates from the producer's mapping.
-
createAssociatedTableGroup
public TableGroup createAssociatedTableGroup(boolean canUseInnerJoins, NavigablePath append, boolean fetched, String sourceAlias, SqlAliasBase sqlAliasBase, SqlAstCreationState creationState)
-
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
-
getJdbcMapping
public JdbcMapping getJdbcMapping(int index)
- Specified by:
getJdbcMapping
in interfaceJdbcMappingContainer
-
-