Package org.hibernate.metamodel.internal
Class AbstractCompositeIdentifierMapping
- java.lang.Object
-
- org.hibernate.metamodel.internal.AbstractCompositeIdentifierMapping
-
- All Implemented Interfaces:
Bindable
,CompositeIdentifierMapping
,EmbeddableValuedModelPart
,EntityIdentifierMapping
,JdbcMappingContainer
,MappingModelExpressible
,ModelPart
,ModelPartContainer
,SelectableMappings
,ValuedModelPart
,ValueMapping
,TableGroupJoinProducer
,TableGroupProducer
,EmbeddableValuedFetchable
,Fetchable
,FetchableContainer
,FetchOptions
,FetchStyleAccess
,FetchTimingAccess
,JavaTypedExpressible
- Direct Known Subclasses:
EmbeddedIdentifierMappingImpl
,NonAggregatedIdentifierMappingImpl
public abstract class AbstractCompositeIdentifierMapping extends Object implements CompositeIdentifierMapping, EmbeddableValuedFetchable, FetchOptions
Base implementation for composite identifier mappings
-
-
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.EntityIdentifierMapping
EntityIdentifierMapping.Nature
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.ModelPart
ModelPart.JdbcValueBiConsumer<X,Y>, ModelPart.JdbcValueConsumer
-
-
Field Summary
Fields Modifier and Type Field Description protected SessionFactoryImplementor
sessionFactory
-
Fields inherited from interface org.hibernate.metamodel.mapping.EntityIdentifierMapping
ID_ROLE_NAME, LEGACY_ID_NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractCompositeIdentifierMapping(AbstractCompositeIdentifierMapping original)
AbstractCompositeIdentifierMapping(EntityMappingType entityMapping, String tableExpression, MappingModelCreationProcess creationProcess)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
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.EntityMappingType
findContainingEntityMapping()
ModelPart
findSubPart(String name, EntityMappingType treatTargetType)
<X,Y>
intforEachJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> valuesConsumer, SharedSessionContractImplementor session)
Visit each constituent JDBC value extracted from the entity instance itself.Fetch
generateFetch(FetchParent fetchParent, NavigablePath fetchablePath, FetchTiming fetchTiming, boolean selected, String resultVariable, DomainResultCreationState creationState)
Generates a Fetch of this fetchableString
getContainingTableExpression()
The table which contains the columns mapped by this valueEmbeddableMappingType
getEmbeddableTypeDescriptor()
protected EntityMappingType
getEntityMapping()
FetchOptions
getMappedFetchOptions()
The configured fetch timing and styleEmbeddableMappingType
getMappedType()
Descriptor for the type of this mappingNavigableRole
getNavigableRole()
FetchStyle
getStyle()
FetchTiming
getTiming()
boolean
hasContainingClass()
Does the identifier have a corresponding EmbeddableId or IdClass?boolean
hasPartitionedSelectionMapping()
Object
instantiate()
Instantiate an instance of the identifier.SqlTuple
toSqlExpression(TableGroup tableGroup, Clause clause, SqmToSqlAstConverter walker, SqlAstCreationState sqlAstCreationState)
void
visitSubParts(Consumer<ModelPart> consumer, EntityMappingType treatTargetType)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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.CompositeIdentifierMapping
getFetchableKey, getMappedIdEmbeddableTypeDescriptor, getPartMappingType, getUnsavedStrategy
-
Methods inherited from interface org.hibernate.sql.results.graph.embeddable.EmbeddableValuedFetchable
getDefaultSqlAstJoinType, isSimpleJoinPredicate
-
Methods inherited from interface org.hibernate.metamodel.mapping.EmbeddableValuedModelPart
addToCacheKey, breakDownJdbcValues, decompose, disassemble, forEachDisassembledJdbcValue, forEachInsertable, forEachJdbcType, forEachSelectable, forEachSubPart, forEachUpdatable, getFetchable, getJavaType, getJdbcMapping, getJdbcTypeCount, getNumberOfFetchables, getParentInjectionAttributePropertyAccess, getSelectable, getSelectableIndex
-
Methods inherited from interface org.hibernate.metamodel.mapping.EntityIdentifierMapping
getAttributeName, getIdentifier, getIdentifier, getIdentifierIfNotUnsaved, getNature, getPartName, isEntityIdentifierMapping, setIdentifier
-
Methods inherited from interface org.hibernate.sql.results.graph.Fetchable
asAttributeMapping, getFetchableName, incrementFetchDepth, isSelectable, resolveCircularFetch
-
Methods inherited from interface org.hibernate.sql.results.graph.FetchableContainer
getKeyFetchable, getNumberOfFetchableKeys, getNumberOfKeyFetchables, visitFetchables, visitFetchables, visitFetchables, visitKeyFetchables, visitKeyFetchables, visitKeyFetchables
-
Methods inherited from interface org.hibernate.type.descriptor.java.JavaTypedExpressible
addToCacheKey
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPart
applySqlSelections, applySqlSelections, areEqual, asBasicValuedModelPart, asEntityMappingType, breakDownJdbcValues, decompose, 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
forEachNonFormula, forEachSelectable, getSingleJdbcMapping
-
Methods inherited from interface org.hibernate.metamodel.mapping.ValueMapping
getExpressibleJavaType, treatAs
-
-
-
-
Field Detail
-
sessionFactory
protected final SessionFactoryImplementor sessionFactory
-
-
Constructor Detail
-
AbstractCompositeIdentifierMapping
public AbstractCompositeIdentifierMapping(EntityMappingType entityMapping, String tableExpression, MappingModelCreationProcess creationProcess)
-
AbstractCompositeIdentifierMapping
protected AbstractCompositeIdentifierMapping(AbstractCompositeIdentifierMapping original)
-
-
Method Detail
-
hasContainingClass
public boolean hasContainingClass()
Description copied from interface:CompositeIdentifierMapping
Does the identifier have a corresponding EmbeddableId or IdClass?- Specified by:
hasContainingClass
in interfaceCompositeIdentifierMapping
- Returns:
- false if there is not an IdCass or an EmbeddableId
-
getMappedType
public EmbeddableMappingType getMappedType()
Description copied from interface:ValueMapping
Descriptor for the type of this mapping- Specified by:
getMappedType
in interfaceEmbeddableValuedModelPart
- Specified by:
getMappedType
in interfaceValueMapping
-
getEmbeddableTypeDescriptor
public EmbeddableMappingType getEmbeddableTypeDescriptor()
- Specified by:
getEmbeddableTypeDescriptor
in interfaceEmbeddableValuedModelPart
-
getContainingTableExpression
public String getContainingTableExpression()
Description copied from interface:ValuedModelPart
The table which contains the columns mapped by this value- Specified by:
getContainingTableExpression
in interfaceValuedModelPart
-
getNavigableRole
public NavigableRole getNavigableRole()
- Specified by:
getNavigableRole
in interfaceModelPart
- See Also:
ModelPart.getPartName()
-
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
-
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.
-
findSubPart
public ModelPart findSubPart(String name, EntityMappingType treatTargetType)
- Specified by:
findSubPart
in interfaceEmbeddableValuedModelPart
- Specified by:
findSubPart
in interfaceModelPartContainer
-
visitSubParts
public void visitSubParts(Consumer<ModelPart> consumer, EntityMappingType treatTargetType)
- Specified by:
visitSubParts
in interfaceEmbeddableValuedModelPart
- Specified by:
visitSubParts
in interfaceModelPartContainer
-
forEachJdbcValue
public <X,Y> int forEachJdbcValue(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X,Y> valuesConsumer, SharedSessionContractImplementor session)
Description copied from interface:Bindable
Visit each constituent JDBC value extracted from the entity instance itself. Short-hand form of callingBindable.disassemble(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor)
and piping its result toBindable.forEachDisassembledJdbcValue(Object, int, JdbcValuesConsumer, SharedSessionContractImplementor)
- Specified by:
forEachJdbcValue
in interfaceBindable
- Specified by:
forEachJdbcValue
in interfaceEmbeddableValuedModelPart
-
toSqlExpression
public SqlTuple toSqlExpression(TableGroup tableGroup, Clause clause, SqmToSqlAstConverter walker, SqlAstCreationState sqlAstCreationState)
- Specified by:
toSqlExpression
in interfaceEmbeddableValuedModelPart
-
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
-
instantiate
public Object instantiate()
Description copied from interface:EntityIdentifierMapping
Instantiate an instance of the identifier.- Specified by:
instantiate
in interfaceEntityIdentifierMapping
-
findContainingEntityMapping
public EntityMappingType findContainingEntityMapping()
- Specified by:
findContainingEntityMapping
in interfaceModelPart
-
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
-
getEntityMapping
protected EntityMappingType getEntityMapping()
-
hasPartitionedSelectionMapping
public boolean hasPartitionedSelectionMapping()
- Specified by:
hasPartitionedSelectionMapping
in interfaceEmbeddableValuedModelPart
- Specified by:
hasPartitionedSelectionMapping
in interfaceModelPart
-
containsTableReference
public boolean containsTableReference(String tableExpression)
- Specified by:
containsTableReference
in interfaceTableGroupProducer
-
-