Class NonAggregatedIdentifierMappingImpl
- java.lang.Object
-
- org.hibernate.metamodel.internal.AbstractCompositeIdentifierMapping
-
- org.hibernate.metamodel.mapping.internal.NonAggregatedIdentifierMappingImpl
-
- All Implemented Interfaces:
Bindable,CompositeIdentifierMapping,EmbeddableValuedModelPart,EntityIdentifierMapping,JdbcMappingContainer,MappingModelExpressible,ModelPart,ModelPartContainer,NonAggregatedIdentifierMapping,SelectableMappings,ValuedModelPart,ValueMapping,VirtualModelPart,TableGroupJoinProducer,TableGroupProducer,EmbeddableValuedFetchable,Fetchable,FetchableContainer,FetchOptions,FetchStyleAccess,FetchTimingAccess,JavaTypedExpressible
public class NonAggregatedIdentifierMappingImpl extends AbstractCompositeIdentifierMapping implements NonAggregatedIdentifierMapping
-
-
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
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.NonAggregatedIdentifierMapping
NonAggregatedIdentifierMapping.IdentifierValueMapper
-
-
Field Summary
-
Fields inherited from class org.hibernate.metamodel.internal.AbstractCompositeIdentifierMapping
sessionFactory
-
Fields inherited from interface org.hibernate.metamodel.mapping.EntityIdentifierMapping
ID_ROLE_NAME, LEGACY_ID_NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNonAggregatedIdentifierMappingImpl(NonAggregatedIdentifierMappingImpl original)NonAggregatedIdentifierMappingImpl(EntityPersister entityPersister, RootClass bootEntityDescriptor, String rootTableName, String[] rootTableKeyColumnNames, MappingModelCreationProcess creationProcess)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddToCacheKey(MutableCacheKeyBuilder cacheKey, Object value, SharedSessionContractImplementor session)Add to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.voidapplySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState)Apply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.voidapplySqlSelections(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.booleanareEqual(@Nullable Object one, @Nullable Object other, SharedSessionContractImplementor session)<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.<T> DomainResult<T>createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState)Create a DomainResult for a specific reference to this ModelPart.Objectdisassemble(Object value, SharedSessionContractImplementor session)Breaks down a value ofJinto its simple pieces.<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.FetchgenerateFetch(FetchParent fetchParent, NavigablePath fetchablePath, FetchTiming fetchTiming, boolean selected, String resultVariable, DomainResultCreationState creationState)Generates a Fetch of this fetchableStringgetAttributeName()The name of the attribute defining the id, if oneFetchablegetFetchable(int position)StringgetFetchableName()The name of the fetchable.IdClassEmbeddablegetIdClassEmbeddable()The id-class representation of this id mappingObjectgetIdentifier(Object entity)Extract the identifier from an instance of the entityObjectgetIdentifier(Object entity, MergeContext mergeContext)Extract the identifier from an instance of the entity It's supposed to be use during the merging processNonAggregatedIdentifierMapping.IdentifierValueMappergetIdentifierValueMapper()The id-class, if there is one, otherwise the virtual-id.EmbeddableMappingTypegetMappedIdEmbeddableTypeDescriptor()Returns the embeddable type descriptor of the id-class, if there is one, otherwise the one of the virtual embeddable mapping type.EmbeddableMappingTypegetMappedType()Descriptor for the type of this mappingEntityIdentifierMapping.NaturegetNature()intgetNumberOfFetchables()The number of fetchables in the containerEmbeddableMappingTypegetPartMappingType()The type for this part.StringgetSqlAliasStem()Get the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generatedVirtualIdEmbeddablegetVirtualIdEmbeddable()The virtual-id representation of this id mappingbooleanhasContainingClass()Does the identifier have a corresponding EmbeddableId or IdClass?voidsetIdentifier(Object entity, Object id, SharedSessionContractImplementor session)Inject an identifier value into an instance of the entitySqlTupletoSqlExpression(TableGroup tableGroup, Clause clause, SqmToSqlAstConverter walker, SqlAstCreationState sqlAstCreationState)-
Methods inherited from class org.hibernate.metamodel.internal.AbstractCompositeIdentifierMapping
containsTableReference, createRootTableGroupJoin, createTableGroupJoin, findContainingEntityMapping, findSubPart, getContainingTableExpression, getEmbeddableTypeDescriptor, getEntityMapping, getMappedFetchOptions, getNavigableRole, getStyle, getTiming, hasPartitionedSelectionMapping, instantiate, visitSubParts
-
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
getUnsavedStrategy
-
Methods inherited from interface org.hibernate.sql.results.graph.embeddable.EmbeddableValuedFetchable
getDefaultSqlAstJoinType, isSimpleJoinPredicate
-
Methods inherited from interface org.hibernate.metamodel.mapping.EmbeddableValuedModelPart
decompose, findSubPart, forEachDisassembledJdbcValue, forEachInsertable, forEachJdbcType, forEachSelectable, forEachSubPart, forEachUpdatable, getEmbeddableTypeDescriptor, getJavaType, getJdbcMapping, getJdbcTypeCount, getParentInjectionAttributePropertyAccess, getSelectable, getSelectableIndex, hasPartitionedSelectionMapping, visitSubParts
-
Methods inherited from interface org.hibernate.metamodel.mapping.EntityIdentifierMapping
getIdentifierIfNotUnsaved, getPartName, instantiate, isEntityIdentifierMapping
-
Methods inherited from interface org.hibernate.sql.results.graph.Fetchable
asAttributeMapping, getMappedFetchOptions, 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.sql.results.graph.FetchStyleAccess
getStyle
-
Methods inherited from interface org.hibernate.sql.results.graph.FetchTimingAccess
getTiming
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPart
asBasicValuedModelPart, asEntityMappingType, breakDownJdbcValues, decompose, findContainingEntityMapping, getNavigableRole
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPartContainer
findByPath, findByPath, forEachSubPart
-
Methods inherited from interface org.hibernate.metamodel.mapping.NonAggregatedIdentifierMapping
getFetchableKey
-
Methods inherited from interface org.hibernate.sql.ast.tree.from.TableGroupJoinProducer
createRootTableGroupJoin, createTableGroupJoin, determineSqlJoinType
-
Methods inherited from interface org.hibernate.sql.ast.tree.from.TableGroupProducer
containsTableReference
-
Methods inherited from interface org.hibernate.metamodel.mapping.ValuedModelPart
forEachNonFormula, forEachSelectable, getContainingTableExpression, getSingleJdbcMapping
-
Methods inherited from interface org.hibernate.metamodel.mapping.ValueMapping
getExpressibleJavaType, treatAs
-
Methods inherited from interface org.hibernate.metamodel.mapping.VirtualModelPart
isVirtual
-
-
-
-
Constructor Detail
-
NonAggregatedIdentifierMappingImpl
public NonAggregatedIdentifierMappingImpl(EntityPersister entityPersister, RootClass bootEntityDescriptor, String rootTableName, String[] rootTableKeyColumnNames, MappingModelCreationProcess creationProcess)
-
NonAggregatedIdentifierMappingImpl
protected NonAggregatedIdentifierMappingImpl(NonAggregatedIdentifierMappingImpl original)
-
-
Method Detail
-
getMappedType
public EmbeddableMappingType getMappedType()
Description copied from interface:ValueMappingDescriptor for the type of this mapping- Specified by:
getMappedTypein interfaceEmbeddableValuedModelPart- Specified by:
getMappedTypein interfaceValueMapping- Overrides:
getMappedTypein classAbstractCompositeIdentifierMapping
-
getPartMappingType
public EmbeddableMappingType getPartMappingType()
Description copied from interface:ModelPartThe type for this part.- Specified by:
getPartMappingTypein interfaceCompositeIdentifierMapping- Specified by:
getPartMappingTypein interfaceModelPart
-
getIdClassEmbeddable
public IdClassEmbeddable getIdClassEmbeddable()
Description copied from interface:NonAggregatedIdentifierMappingThe id-class representation of this id mapping- Specified by:
getIdClassEmbeddablein interfaceNonAggregatedIdentifierMapping
-
getVirtualIdEmbeddable
public VirtualIdEmbeddable getVirtualIdEmbeddable()
Description copied from interface:NonAggregatedIdentifierMappingThe virtual-id representation of this id mapping- Specified by:
getVirtualIdEmbeddablein interfaceNonAggregatedIdentifierMapping
-
getIdentifierValueMapper
public NonAggregatedIdentifierMapping.IdentifierValueMapper getIdentifierValueMapper()
Description copied from interface:NonAggregatedIdentifierMappingThe id-class, if there is one, otherwise the virtual-id.- Specified by:
getIdentifierValueMapperin interfaceNonAggregatedIdentifierMapping
-
hasContainingClass
public boolean hasContainingClass()
Description copied from interface:CompositeIdentifierMappingDoes the identifier have a corresponding EmbeddableId or IdClass?- Specified by:
hasContainingClassin interfaceCompositeIdentifierMapping- Overrides:
hasContainingClassin classAbstractCompositeIdentifierMapping- Returns:
- false if there is not an IdCass or an EmbeddableId
-
getMappedIdEmbeddableTypeDescriptor
public EmbeddableMappingType getMappedIdEmbeddableTypeDescriptor()
Description copied from interface:CompositeIdentifierMappingReturns the embeddable type descriptor of the id-class, if there is one, otherwise the one of the virtual embeddable mapping type.- Specified by:
getMappedIdEmbeddableTypeDescriptorin interfaceCompositeIdentifierMapping
-
areEqual
public boolean areEqual(@Nullable Object one, @Nullable Object other, SharedSessionContractImplementor session)
-
disassemble
public Object disassemble(Object value, SharedSessionContractImplementor session)
Description copied from interface:BindableBreaks down a value ofJinto its simple pieces. E.g., an embedded value gets broken down into an array of its attribute state; a basic value converts to itself; etc.Generally speaking, this is the form in which entity state is kept relative to a Session via
EntityEntry.@Entity class Person { @Id Integer id; @Embedded Name name; int age; } @Embeddable class Name { String familiarName; String familyName; }At the top level, we would want to disassemble a
Personvalue, so we'd ask theBindablefor thePersonentity to disassemble. Given aPersonvalue:Person( id=1, name=Name( 'Steve', 'Ebersole' ), 28 )
this disassemble would result in a multidimensional array:
[ ["Steve", "Ebersole"], 28 ]
Note that the identifier is not part of this disassembled state. Note also how the embedded value results in a sub-array.
- Specified by:
disassemblein interfaceBindable- Specified by:
disassemblein interfaceEmbeddableValuedModelPart- See Also:
EntityEntry
-
addToCacheKey
public void addToCacheKey(MutableCacheKeyBuilder cacheKey, Object value, SharedSessionContractImplementor session)
Description copied from interface:BindableAdd to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.- Specified by:
addToCacheKeyin interfaceBindable- Specified by:
addToCacheKeyin interfaceEmbeddableValuedModelPart- Specified by:
addToCacheKeyin interfaceJavaTypedExpressible- Parameters:
cacheKey- the MutableCacheKey used to add the disassembled value and the hashCodevalue- the value to disassemblesession- the SharedSessionContractImplementor
-
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:BindableVisit 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:
forEachJdbcValuein interfaceBindable- Specified by:
forEachJdbcValuein interfaceEmbeddableValuedModelPart- Overrides:
forEachJdbcValuein classAbstractCompositeIdentifierMapping
-
toSqlExpression
public SqlTuple toSqlExpression(TableGroup tableGroup, Clause clause, SqmToSqlAstConverter walker, SqlAstCreationState sqlAstCreationState)
- Specified by:
toSqlExpressionin interfaceEmbeddableValuedModelPart- Overrides:
toSqlExpressionin classAbstractCompositeIdentifierMapping
-
getNature
public EntityIdentifierMapping.Nature getNature()
- Specified by:
getNaturein interfaceEntityIdentifierMapping- See Also:
EntityIdentifierMapping.Nature
-
getAttributeName
public String getAttributeName()
Description copied from interface:EntityIdentifierMappingThe name of the attribute defining the id, if one- Specified by:
getAttributeNamein interfaceEntityIdentifierMapping
-
getIdentifier
public Object getIdentifier(Object entity)
Description copied from interface:EntityIdentifierMappingExtract the identifier from an instance of the entity- Specified by:
getIdentifierin interfaceEntityIdentifierMapping
-
getIdentifier
public Object getIdentifier(Object entity, MergeContext mergeContext)
Description copied from interface:EntityIdentifierMappingExtract the identifier from an instance of the entity It's supposed to be use during the merging process- Specified by:
getIdentifierin interfaceEntityIdentifierMapping
-
setIdentifier
public void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session)
Description copied from interface:EntityIdentifierMappingInject an identifier value into an instance of the entity- Specified by:
setIdentifierin interfaceEntityIdentifierMapping
-
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:ModelPartBreaks 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 valuesXandYto the consumer. Returns the amount of jdbc types that have been visited.- Specified by:
breakDownJdbcValuesin interfaceEmbeddableValuedModelPart- Specified by:
breakDownJdbcValuesin interfaceModelPart
-
applySqlSelections
public void applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState)
Description copied from interface:ModelPartApply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.- Specified by:
applySqlSelectionsin interfaceModelPart
-
applySqlSelections
public void applySqlSelections(NavigablePath navigablePath, TableGroup tableGroup, DomainResultCreationState creationState, BiConsumer<SqlSelection,JdbcMapping> selectionConsumer)
Description copied from interface:ModelPartApply SQL selections for a specific reference to this ModelPart outside the domain query's root select clause.- Specified by:
applySqlSelectionsin interfaceModelPart
-
createDomainResult
public <T> DomainResult<T> createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState)
Description copied from interface:ModelPartCreate a DomainResult for a specific reference to this ModelPart.- Specified by:
createDomainResultin interfaceModelPart- Overrides:
createDomainResultin classAbstractCompositeIdentifierMapping
-
generateFetch
public Fetch generateFetch(FetchParent fetchParent, NavigablePath fetchablePath, FetchTiming fetchTiming, boolean selected, String resultVariable, DomainResultCreationState creationState)
Description copied from interface:FetchableGenerates a Fetch of this fetchable- Specified by:
generateFetchin interfaceFetchable- Overrides:
generateFetchin classAbstractCompositeIdentifierMapping- Parameters:
fetchParent- The parent of the Fetch we are generatingfetchablePath- The overall path within the graphfetchTiming- The requested fetch timing
-
getSqlAliasStem
public String getSqlAliasStem()
Description copied from interface:TableGroupProducerGet the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generatedNote that this is a metadata-ive value. It is only ever used internal to the producer producing its TableGroup.
- Specified by:
getSqlAliasStemin interfaceTableGroupProducer- See Also:
SqlAliasBaseManager.createSqlAliasBase(java.lang.String)
-
getFetchableName
public String getFetchableName()
Description copied from interface:FetchableThe name of the fetchable. This is the part's "local name".- Specified by:
getFetchableNamein interfaceFetchable- See Also:
ModelPart.getNavigableRole(),NavigableRole.getLocalName()
-
getNumberOfFetchables
public int getNumberOfFetchables()
Description copied from interface:FetchableContainerThe number of fetchables in the container- Specified by:
getNumberOfFetchablesin interfaceEmbeddableValuedModelPart- Specified by:
getNumberOfFetchablesin interfaceFetchableContainer
-
getFetchable
public Fetchable getFetchable(int position)
- Specified by:
getFetchablein interfaceEmbeddableValuedModelPart- Specified by:
getFetchablein interfaceFetchableContainer
-
-