Class PluralAttributeMappingImpl
- java.lang.Object
-
- org.hibernate.metamodel.mapping.internal.AbstractAttributeMapping
-
- org.hibernate.metamodel.mapping.internal.PluralAttributeMappingImpl
-
- All Implemented Interfaces:
Loadable
,AttributeMapping
,Bindable
,FilterRestrictable
,JdbcMappingContainer
,MappingModelExpressible
,ModelPart
,ModelPartContainer
,PluralAttributeMapping
,PropertyBasedMapping
,Queryable
,Restrictable
,ValueMapping
,WhereRestrictable
,RootTableGroupProducer
,TableGroupJoinProducer
,TableGroupProducer
,DatabaseSnapshotContributor
,Fetchable
,FetchableContainer
,FetchOptions
,FetchStyleAccess
,FetchTimingAccess
,JavaTypedExpressible
,MutabilityPlanExposer
public class PluralAttributeMappingImpl extends AbstractAttributeMapping implements PluralAttributeMapping, FetchOptions
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
PluralAttributeMappingImpl.Aware
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.Bindable
Bindable.JdbcValuesConsumer
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.ModelPart
ModelPart.JdbcValueConsumer
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.PluralAttributeMapping
PluralAttributeMapping.IndexMetadata
-
-
Constructor Summary
Constructors Constructor Description PluralAttributeMappingImpl(String attributeName, Collection bootDescriptor, PropertyAccess propertyAccess, AttributeMetadataAccess attributeMetadataAccess, CollectionMappingType<?> collectionMappingType, int stateArrayPosition, CollectionPart elementDescriptor, CollectionPart indexDescriptor, CollectionIdentifierDescriptor identifierDescriptor, FetchTiming fetchTiming, FetchStyle fetchStyle, CascadeStyle cascadeStyle, ManagedMappingType declaringType, CollectionPersister collectionDescriptor)
-
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.TableGroup
createRootTableGroup(boolean canUseInnerJoins, NavigablePath navigablePath, String explicitSourceAlias, Supplier<Consumer<Predicate>> additionalPredicateCollectorAccess, SqlAliasBase sqlAliasBase, SqlExpressionResolver expressionResolver, FromClauseAccess fromClauseAccess, SqlAstCreationContext creationContext)
TableGroup
createRootTableGroup(boolean canUseInnerJoins, NavigablePath navigablePath, String explicitSourceAlias, Supplier<Consumer<Predicate>> additionalPredicateCollectorAccess, SqlAstCreationState creationState, SqlAstCreationContext creationContext)
Create a root TableGroup as defined by this producerTableGroup
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.TableGroupJoin
createTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, 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)
ModelPart
findSubPart(String name, EntityMappingType treatTargetType)
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(Property bootProperty, Collection bootDescriptor, MappingModelCreationProcess creationProcess)
int
forEachDisassembledJdbcValue(Object value, Clause clause, int offset, Bindable.JdbcValuesConsumer valuesConsumer, SharedSessionContractImplementor session)
int
forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)
Visit each JdbcMapping starting from the given offsetFetch
generateFetch(FetchParent fetchParent, NavigablePath fetchablePath, FetchTiming fetchTiming, boolean selected, String resultVariable, DomainResultCreationState creationState)
Generates a Fetch of this fetchableAttributeMetadataAccess
getAttributeMetadataAccess()
Access to AttributeMetadataCollectionPersister
getCollectionDescriptor()
SqlAstJoinType
getDefaultSqlAstJoinType(TableGroup parentTableGroup)
CollectionPart
getElementDescriptor()
String
getFetchableName()
The name of the fetchableCollectionIdentifierDescriptor
getIdentifierDescriptor()
CollectionPart
getIndexDescriptor()
PluralAttributeMapping.IndexMetadata
getIndexMetadata()
int
getJdbcTypeCount()
The number of JDBC mappingsForeignKeyDescriptor
getKeyDescriptor()
OrderByFragment
getManyToManyOrderByFragment()
FetchOptions
getMappedFetchOptions()
The configured fetch timing and styleCollectionMappingType
getMappedType()
Descriptor for the type of this mappingNavigableRole
getNavigableRole()
OrderByFragment
getOrderByFragment()
PropertyAccess
getPropertyAccess()
The getter/setter access to this attributeString
getRootPathName()
String
getSeparateCollectionTable()
String
getSqlAliasStem()
Get the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generatedint
getStateArrayPosition()
The attribute's position within the container's state arrayFetchStyle
getStyle()
FetchTiming
getTiming()
ValueGeneration
getValueGeneration()
The value generation strategy to use for this attribute.boolean
isAffectedByEnabledFetchProfiles(LoadQueryInfluencers influencers)
boolean
isAffectedByEnabledFilters(LoadQueryInfluencers influencers)
boolean
isAffectedByEntityGraph(LoadQueryInfluencers influencers)
boolean
isBidirectionalAttributeName(NavigablePath fetchablePath, ToOneAttributeMapping modelPart)
boolean
isSimpleJoinPredicate(Predicate predicate)
Returns whether the given predicate is a simple join predicate for this attribute.Fetch
resolveCircularFetch(NavigablePath fetchablePath, FetchParent fetchParent, FetchTiming fetchTiming, DomainResultCreationState creationState)
Check whether this Fetchable is considered a circular fetch.void
setForeignKeyDescriptor(ForeignKeyDescriptor fkDescriptor)
String
toString()
void
visitSubParts(Consumer<ModelPart> consumer, EntityMappingType treatTargetType)
LikeQueryable.findSubPart(java.lang.String, org.hibernate.metamodel.mapping.EntityMappingType)
, this form visits all parts defined on the entity, its super-types and its sub-types.-
Methods inherited from class org.hibernate.metamodel.mapping.internal.AbstractAttributeMapping
getAttributeName, getDeclaringType, getJavaType, getPartMappingType
-
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.AttributeMapping
asAttributeMapping, asEmbeddedAttributeMapping, findContainingEntityMapping, getAttributeName, getDeclaringType, getExposedMutabilityPlan, getPartName, getValue, isEmbeddedAttributeMapping, setValue
-
Methods inherited from interface org.hibernate.metamodel.mapping.Bindable
forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachJdbcValue, getJdbcMappings
-
Methods inherited from interface org.hibernate.sql.results.graph.FetchableContainer
visitFetchables, visitKeyFetchables
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPart
areEqual, forEachSelectable, forEachSelectable, getJavaType, getPartMappingType
-
Methods inherited from interface org.hibernate.metamodel.mapping.PluralAttributeMapping
applyBaseManyToManyRestrictions, applyBaseRestrictions, applyFilterRestrictions, applyWhereRestrictions, asPluralAttributeMapping, createSnapshotDomainResult, getFetchable, getKeyFetchable, getNumberOfFetchables, getNumberOfKeyFetchables, incrementFetchDepth, isPluralAttributeMapping, visitFetchables, visitFetchables, visitKeyFetchables, visitKeyFetchables
-
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
-
Methods inherited from interface org.hibernate.metamodel.mapping.ValueMapping
getExpressibleJavaType, treatAs
-
-
-
-
Constructor Detail
-
PluralAttributeMappingImpl
public PluralAttributeMappingImpl(String attributeName, Collection bootDescriptor, PropertyAccess propertyAccess, AttributeMetadataAccess attributeMetadataAccess, CollectionMappingType<?> collectionMappingType, int stateArrayPosition, CollectionPart elementDescriptor, CollectionPart indexDescriptor, CollectionIdentifierDescriptor identifierDescriptor, FetchTiming fetchTiming, FetchStyle fetchStyle, CascadeStyle cascadeStyle, ManagedMappingType declaringType, CollectionPersister collectionDescriptor)
-
-
Method Detail
-
isBidirectionalAttributeName
public boolean isBidirectionalAttributeName(NavigablePath fetchablePath, ToOneAttributeMapping modelPart)
- Specified by:
isBidirectionalAttributeName
in interfacePluralAttributeMapping
-
finishInitialization
public void finishInitialization(Property bootProperty, Collection bootDescriptor, MappingModelCreationProcess creationProcess)
-
getNavigableRole
public NavigableRole getNavigableRole()
- Specified by:
getNavigableRole
in interfaceModelPart
- See Also:
ModelPart.getPartName()
-
getMappedType
public CollectionMappingType getMappedType()
Description copied from interface:ValueMapping
Descriptor for the type of this mapping- Specified by:
getMappedType
in interfacePluralAttributeMapping
- Specified by:
getMappedType
in interfaceValueMapping
-
getKeyDescriptor
public ForeignKeyDescriptor getKeyDescriptor()
- Specified by:
getKeyDescriptor
in interfacePluralAttributeMapping
-
getCollectionDescriptor
public CollectionPersister getCollectionDescriptor()
- Specified by:
getCollectionDescriptor
in interfacePluralAttributeMapping
-
getElementDescriptor
public CollectionPart getElementDescriptor()
- Specified by:
getElementDescriptor
in interfacePluralAttributeMapping
-
getIndexDescriptor
public CollectionPart getIndexDescriptor()
- Specified by:
getIndexDescriptor
in interfacePluralAttributeMapping
-
getIndexMetadata
public PluralAttributeMapping.IndexMetadata getIndexMetadata()
- Specified by:
getIndexMetadata
in interfacePluralAttributeMapping
-
getIdentifierDescriptor
public CollectionIdentifierDescriptor getIdentifierDescriptor()
- Specified by:
getIdentifierDescriptor
in interfacePluralAttributeMapping
-
getOrderByFragment
public OrderByFragment getOrderByFragment()
- Specified by:
getOrderByFragment
in interfacePluralAttributeMapping
-
getManyToManyOrderByFragment
public OrderByFragment getManyToManyOrderByFragment()
- Specified by:
getManyToManyOrderByFragment
in interfacePluralAttributeMapping
-
getSeparateCollectionTable
public String getSeparateCollectionTable()
- Specified by:
getSeparateCollectionTable
in interfacePluralAttributeMapping
-
containsTableReference
public boolean containsTableReference(String tableExpression)
- Specified by:
containsTableReference
in interfaceTableGroupProducer
-
getStateArrayPosition
public int getStateArrayPosition()
Description copied from interface:AttributeMapping
The attribute's position within the container's state array- Specified by:
getStateArrayPosition
in interfaceAttributeMapping
-
getAttributeMetadataAccess
public AttributeMetadataAccess getAttributeMetadataAccess()
Description copied from interface:AttributeMapping
Access to AttributeMetadata- Specified by:
getAttributeMetadataAccess
in interfaceAttributeMapping
-
getPropertyAccess
public PropertyAccess getPropertyAccess()
Description copied from interface:AttributeMapping
The getter/setter access to this attribute- Specified by:
getPropertyAccess
in interfaceAttributeMapping
- Specified by:
getPropertyAccess
in interfacePropertyBasedMapping
-
getValueGeneration
public ValueGeneration getValueGeneration()
Description copied from interface:AttributeMapping
The value generation strategy to use for this attribute.- Specified by:
getValueGeneration
in interfaceAttributeMapping
-
getFetchableName
public String getFetchableName()
Description copied from interface:Fetchable
The name of the fetchable- 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
-
getStyle
public FetchStyle getStyle()
- Specified by:
getStyle
in interfaceFetchStyleAccess
-
getTiming
public FetchTiming getTiming()
- Specified by:
getTiming
in interfaceFetchTimingAccess
-
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 interfaceModelPart
-
generateFetch
public Fetch 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 interfaceFetchable
- Parameters:
fetchParent
- The parent of the Fetch we are generatingfetchablePath
- The overall path within the graphfetchTiming
- The requested fetch timing
-
resolveCircularFetch
public Fetch resolveCircularFetch(NavigablePath fetchablePath, FetchParent fetchParent, FetchTiming fetchTiming, DomainResultCreationState creationState)
Description copied from interface:Fetchable
Check whether this Fetchable is considered a circular fetch.- Specified by:
resolveCircularFetch
in interfaceFetchable
- Parameters:
fetchablePath
- The overall path within the graph- Returns:
- The Fetch representing the circularity;
null
indicates the fetch is not circular
-
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)
-
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, 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 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
-
setForeignKeyDescriptor
public void setForeignKeyDescriptor(ForeignKeyDescriptor fkDescriptor)
-
createRootTableGroup
public TableGroup createRootTableGroup(boolean canUseInnerJoins, NavigablePath navigablePath, String explicitSourceAlias, Supplier<Consumer<Predicate>> additionalPredicateCollectorAccess, SqlAstCreationState creationState, SqlAstCreationContext creationContext)
Description copied from interface:RootTableGroupProducer
Create a root TableGroup as defined by this producer- Specified by:
createRootTableGroup
in interfaceRootTableGroupProducer
-
createRootTableGroup
public TableGroup createRootTableGroup(boolean canUseInnerJoins, NavigablePath navigablePath, String explicitSourceAlias, Supplier<Consumer<Predicate>> additionalPredicateCollectorAccess, SqlAliasBase sqlAliasBase, SqlExpressionResolver expressionResolver, FromClauseAccess fromClauseAccess, SqlAstCreationContext creationContext)
- Specified by:
createRootTableGroup
in interfaceRootTableGroupProducer
-
isAffectedByEnabledFilters
public boolean isAffectedByEnabledFilters(LoadQueryInfluencers influencers)
- Specified by:
isAffectedByEnabledFilters
in interfaceLoadable
-
isAffectedByEntityGraph
public boolean isAffectedByEntityGraph(LoadQueryInfluencers influencers)
- Specified by:
isAffectedByEntityGraph
in interfaceLoadable
-
isAffectedByEnabledFetchProfiles
public boolean isAffectedByEnabledFetchProfiles(LoadQueryInfluencers influencers)
- Specified by:
isAffectedByEnabledFetchProfiles
in interfaceLoadable
-
getRootPathName
public String getRootPathName()
- Specified by:
getRootPathName
in interfaceLoadable
-
findSubPart
public ModelPart findSubPart(String name, EntityMappingType treatTargetType)
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 interfaceQueryable
-
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 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 interfaceModelPart
-
breakDownJdbcValues
public void breakDownJdbcValues(Object domainValue, ModelPart.JdbcValueConsumer valueConsumer, SharedSessionContractImplementor session)
- Specified by:
breakDownJdbcValues
in interfaceModelPart
-
visitSubParts
public void visitSubParts(Consumer<ModelPart> consumer, EntityMappingType treatTargetType)
Description copied from interface:Queryable
LikeQueryable.findSubPart(java.lang.String, org.hibernate.metamodel.mapping.EntityMappingType)
, this form visits all parts defined on the entity, its super-types and its sub-types.- Specified by:
visitSubParts
in interfaceQueryable
-
getJdbcTypeCount
public int getJdbcTypeCount()
Description copied from interface:Bindable
The number of JDBC mappings- Specified by:
getJdbcTypeCount
in interfaceBindable
- Specified by:
getJdbcTypeCount
in interfaceJdbcMappingContainer
-
forEachJdbcType
public int forEachJdbcType(int offset, IndexedConsumer<JdbcMapping> action)
Description copied from interface:JdbcMappingContainer
Visit each JdbcMapping starting from the given offset- Specified by:
forEachJdbcType
in interfaceJdbcMappingContainer
-
disassemble
public Object disassemble(Object value, SharedSessionContractImplementor session)
- Specified by:
disassemble
in interfaceBindable
- See Also:
As an example, consider the following domain model: ````
-
forEachDisassembledJdbcValue
public int forEachDisassembledJdbcValue(Object value, Clause clause, int offset, Bindable.JdbcValuesConsumer valuesConsumer, SharedSessionContractImplementor session)
- Specified by:
forEachDisassembledJdbcValue
in interfaceBindable
-
-