Class ManyToManyCollectionPart
- java.lang.Object
-
- org.hibernate.metamodel.mapping.internal.AbstractEntityCollectionPart
-
- org.hibernate.metamodel.mapping.internal.ManyToManyCollectionPart
-
- All Implemented Interfaces:
Association,Bindable,CollectionPart,EntityAssociationMapping,EntityValuedModelPart,EntityCollectionPart,JdbcMappingContainer,MappingModelExpressible,ModelPart,ModelPartContainer,SelectableMappings,ValuedModelPart,ValueMapping,TableGroupJoinProducer,TableGroupProducer,EntityValuedFetchable,Fetchable,FetchableContainer,FetchOptions,FetchStyleAccess,FetchTimingAccess,JavaTypedExpressible
public class ManyToManyCollectionPart extends AbstractEntityCollectionPart implements EntityAssociationMapping
Entity-valued collection-part mapped through a join table. Models bothManyToManymappingsOneToManywithJoinTablemappings
-
-
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 ManyToManyCollectionPart(CollectionPart.Nature nature, Collection collectionBootDescriptor, CollectionPersister collectionDescriptor, EntityMappingType associatedEntityDescriptor, NotFoundAction notFoundAction, MappingModelCreationProcess creationProcess)ManyToManyCollectionPart(CollectionPart.Nature nature, Collection collectionBootDescriptor, CollectionPersister collectionDescriptor, EntityMappingType associatedEntityDescriptor, MappingModelCreationProcess creationProcess)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbreakDownJdbcValues(Object domainValue, ModelPart.JdbcValueConsumer valueConsumer, SharedSessionContractImplementor session)LazyTableGroupcreateRootTableGroupJoin(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.TableGroupJoincreateTableGroupJoin(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.voiddecompose(Object domainValue, ModelPart.JdbcValueConsumer valueConsumer, SharedSessionContractImplementor session)ModelPartfindSubPart(String name, EntityMappingType targetType)booleanfinishInitialization(CollectionPersister collectionDescriptor, Collection bootCollectionDescriptor, String fkTargetModelPartName, MappingModelCreationProcess creationProcess)Perform any delayed initialization.intforEachSelectable(int offset, SelectableConsumer consumer)Visit each contained selectable mapping.EntityCollectionPart.CardinalitygetCardinality()StringgetContainingTableExpression()The table which contains the columns mapped by this valueSqlAstJoinTypegetDefaultSqlAstJoinType(TableGroup parentTableGroup)ForeignKeyDescriptorgetForeignKeyDescriptor()The descriptor, allowing access to column(s), etcModelPartgetInclusionCheckPart()ModelPartgetKeyTargetMatchPart()The model sub-part relative to the associated entity type that is the target of this association's foreign-keySelectableMappinggetSelectable(int columnIndex)Get the selectable at the given positionForeignKeyDescriptor.NaturegetSideNature()Indicates which "side" of the foreign-key this association describesbooleanhasPartitionedSelectionMapping()booleanisFkOptimizationAllowed()booleanisReferenceToPrimaryKey()booleanisSimpleJoinPredicate(Predicate predicate)Returns whether the given predicate is a simple join predicate for this attribute.protected AssociationKeyresolveFetchAssociationKey()-
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
getPartName
-
Methods inherited from interface org.hibernate.metamodel.mapping.EntityAssociationMapping
getAssociatedEntityMappingType, getFetchableName, incrementFetchDepth
-
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, disassemble, findSubPart, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachSubPart, visitSubParts
-
Methods inherited from interface org.hibernate.sql.results.graph.Fetchable
asAttributeMapping, getFetchableKey, getMappedFetchOptions, 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, 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
-
ManyToManyCollectionPart
public ManyToManyCollectionPart(CollectionPart.Nature nature, Collection collectionBootDescriptor, CollectionPersister collectionDescriptor, EntityMappingType associatedEntityDescriptor, MappingModelCreationProcess creationProcess)
-
ManyToManyCollectionPart
public ManyToManyCollectionPart(CollectionPart.Nature nature, Collection collectionBootDescriptor, CollectionPersister collectionDescriptor, EntityMappingType associatedEntityDescriptor, NotFoundAction notFoundAction, MappingModelCreationProcess creationProcess)
-
-
Method Detail
-
getCardinality
public EntityCollectionPart.Cardinality getCardinality()
- Specified by:
getCardinalityin interfaceEntityCollectionPart
-
getInclusionCheckPart
public ModelPart getInclusionCheckPart()
- Specified by:
getInclusionCheckPartin interfaceCollectionPart
-
resolveFetchAssociationKey
protected AssociationKey resolveFetchAssociationKey()
- Specified by:
resolveFetchAssociationKeyin classAbstractEntityCollectionPart
-
findSubPart
public ModelPart findSubPart(String name, EntityMappingType targetType)
- Specified by:
findSubPartin interfaceEntityValuedModelPart- Specified by:
findSubPartin interfaceModelPartContainer
-
breakDownJdbcValues
public void breakDownJdbcValues(Object domainValue, ModelPart.JdbcValueConsumer valueConsumer, SharedSessionContractImplementor session)
- Specified by:
breakDownJdbcValuesin interfaceModelPart
-
getSelectable
public SelectableMapping getSelectable(int columnIndex)
Description copied from interface:SelectableMappingsGet the selectable at the given position- Specified by:
getSelectablein interfaceSelectableMappings
-
getContainingTableExpression
public String getContainingTableExpression()
Description copied from interface:ValuedModelPartThe table which contains the columns mapped by this value- Specified by:
getContainingTableExpressionin interfaceValuedModelPart
-
forEachSelectable
public int forEachSelectable(int offset, SelectableConsumer consumer)Description copied from interface:SelectableMappingsVisit 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:
forEachSelectablein interfaceModelPart- Specified by:
forEachSelectablein interfaceSelectableMappings- Specified by:
forEachSelectablein interfaceValuedModelPart- See Also:
SelectableConsumer.accept(int, SelectableMapping)
-
decompose
public void decompose(Object domainValue, ModelPart.JdbcValueConsumer valueConsumer, SharedSessionContractImplementor session)
-
getForeignKeyDescriptor
public ForeignKeyDescriptor getForeignKeyDescriptor()
Description copied from interface:AssociationThe descriptor, allowing access to column(s), etc- Specified by:
getForeignKeyDescriptorin interfaceAssociation
-
getSideNature
public ForeignKeyDescriptor.Nature getSideNature()
Description copied from interface:AssociationIndicates which "side" of the foreign-key this association describes- Specified by:
getSideNaturein interfaceAssociation
-
getDefaultSqlAstJoinType
public SqlAstJoinType getDefaultSqlAstJoinType(TableGroup parentTableGroup)
- Specified by:
getDefaultSqlAstJoinTypein interfaceTableGroupJoinProducer
-
isSimpleJoinPredicate
public boolean isSimpleJoinPredicate(Predicate predicate)
Description copied from interface:TableGroupJoinProducerReturns 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:
isSimpleJoinPredicatein interfaceTableGroupJoinProducer
-
isReferenceToPrimaryKey
public boolean isReferenceToPrimaryKey()
- Specified by:
isReferenceToPrimaryKeyin interfaceEntityAssociationMapping
-
isFkOptimizationAllowed
public boolean isFkOptimizationAllowed()
- Specified by:
isFkOptimizationAllowedin interfaceEntityAssociationMapping
-
getKeyTargetMatchPart
public ModelPart getKeyTargetMatchPart()
Description copied from interface:EntityAssociationMappingThe model sub-part relative to the associated entity type that is the target of this association's foreign-key- Specified by:
getKeyTargetMatchPartin interfaceEntityAssociationMapping
-
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:TableGroupJoinProducerCreate 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 explicitONclause, and isfalseotherwise.- Specified by:
createTableGroupJoinin 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:TableGroupJoinProducerCreate 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:
createRootTableGroupJoinin interfaceTableGroupJoinProducer
-
hasPartitionedSelectionMapping
public boolean hasPartitionedSelectionMapping()
- Specified by:
hasPartitionedSelectionMappingin interfaceModelPart
-
finishInitialization
public boolean finishInitialization(CollectionPersister collectionDescriptor, Collection bootCollectionDescriptor, String fkTargetModelPartName, MappingModelCreationProcess creationProcess)
Description copied from interface:EntityCollectionPartPerform any delayed initialization.The initialization is considered successful if the result is
true. It is considered unsuccessful if the result isfalseor 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
NonTransientExceptionmarker to allow the creation process to stop immediately- Specified by:
finishInitializationin interfaceEntityCollectionPart
-
-