Class CompoundNaturalIdMapping
java.lang.Object
org.hibernate.metamodel.mapping.internal.AbstractNaturalIdMapping
org.hibernate.metamodel.mapping.internal.CompoundNaturalIdMapping
- All Implemented Interfaces:
Bindable
,JdbcMappingContainer
,MappingModelExpressible
,MappingType
,ModelPart
,ModelPartContainer
,NaturalIdMapping
,VirtualModelPart
,FetchableContainer
public class CompoundNaturalIdMapping
extends AbstractNaturalIdMapping
implements MappingType, FetchableContainer
Multi-attribute NaturalIdMapping implementation
-
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.ModelPart
ModelPart.JdbcValueBiConsumer<X,
Y>, ModelPart.JdbcValueConsumer -
Field Summary
Fields inherited from interface org.hibernate.metamodel.mapping.NaturalIdMapping
PART_NAME
-
Constructor Summary
ConstructorDescriptionCompoundNaturalIdMapping
(EntityMappingType declaringType, List<SingularAttributeMapping> attributes, MappingModelCreationProcess creationProcess) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToCacheKey
(MutableCacheKeyBuilder cacheKey, Object value, SharedSessionContractImplementor session) Add to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.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.boolean
areEqual
(Object one, Object other, SharedSessionContractImplementor session) <X,
Y> int breakDownJdbcValues
(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.int
calculateHashCode
(Object value) Calculate the hash-code of a natural-id value<T> DomainResult<T>
createDomainResult
(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState) Create a DomainResult for a specific reference to this ModelPart.disassemble
(Object value, SharedSessionContractImplementor session) Breaks down a value ofJ
into its simple pieces.Object[]
extractNaturalIdFromEntity
(Object entity) Given an entity instance, extract the normalized natural id representationObject[]
extractNaturalIdFromEntityState
(Object[] state) Given an array of "full entity state", extract the normalized natural id representationfindSubPart
(String name, EntityMappingType treatTargetType) <X,
Y> int forEachDisassembledJdbcValue
(Object value, int offset, X x, Y y, Bindable.JdbcValuesBiConsumer<X, Y> valuesConsumer, SharedSessionContractImplementor session) LikeBindable.forEachDisassembledJdbcValue(Object, Object, Object, JdbcValuesBiConsumer, SharedSessionContractImplementor)
, but additionally receives an offset by which the selectionIndex is incremented when callingBindable.JdbcValuesBiConsumer.consume(int, Object, Object, Object, JdbcMapping)
.int
forEachJdbcType
(int offset, IndexedConsumer<JdbcMapping> action) Visit each JdbcMapping starting from the given offset<X,
Y> int forEachJdbcValue
(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.int
forEachSelectable
(int offset, SelectableConsumer consumer) Visits each selectable mapping with the selectable index offset by the given value.void
forEachSubPart
(IndexedConsumer<ModelPart> consumer, EntityMappingType treatTarget) getFetchable
(int position) JavaType<?>
The Java type for this part.getJdbcMapping
(int index) int
The number of JDBC mappingsJavaType<?>
The descriptor descriptor for the mapped Java typeThe attribute(s) making up the natural-id.int
The number of fetchables in the containerThe type for this part.boolean
makeLoader
(EntityMappingType entityDescriptor) Make a loader capable of loading a single entity by natural-idmakeMultiLoader
(EntityMappingType entityDescriptor) Make a loader capable of loading multiple entities by natural-idObject[]
normalizeInput
(Object incoming) Normalize a user-provided natural-id value into the representation Hibernate uses internallyvoid
validateInternalForm
(Object naturalIdValue) Validates a natural id value(s) for the described natural-id based on the expected internal representationvoid
verifyFlushState
(Object id, Object[] currentState, Object[] loadedState, SharedSessionContractImplementor session) Verify the natural-id value(s) we are about to flush to the databasevoid
visitSubParts
(Consumer<ModelPart> consumer, EntityMappingType treatTargetType) Methods inherited from class org.hibernate.metamodel.mapping.internal.AbstractNaturalIdMapping
findContainingEntityMapping, getCacheAccess, getDeclaringType, getNavigableRole, isMutable
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.sql.results.graph.FetchableContainer
getKeyFetchable, getNumberOfFetchableKeys, getNumberOfKeyFetchables, getSelectableIndex, visitFetchables, visitFetchables, visitFetchables, visitKeyFetchables, visitKeyFetchables, visitKeyFetchables
Methods inherited from interface org.hibernate.metamodel.mapping.JdbcMappingContainer
getSingleJdbcMapping
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPart
asAttributeMapping, asBasicValuedModelPart, asEntityMappingType, breakDownJdbcValues, decompose, decompose, findContainingEntityMapping, forEachSelectable, getNavigableRole, isEntityIdentifierMapping
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPartContainer
findByPath, findByPath, forEachSubPart
Methods inherited from interface org.hibernate.metamodel.mapping.NaturalIdMapping
getPartName
Methods inherited from interface org.hibernate.metamodel.mapping.VirtualModelPart
isVirtual
-
Constructor Details
-
CompoundNaturalIdMapping
public CompoundNaturalIdMapping(EntityMappingType declaringType, List<SingularAttributeMapping> attributes, MappingModelCreationProcess creationProcess)
-
-
Method Details
-
extractNaturalIdFromEntityState
Description copied from interface:NaturalIdMapping
Given an array of "full entity state", extract the normalized natural id representation- Specified by:
extractNaturalIdFromEntityState
in interfaceNaturalIdMapping
- Parameters:
state
- The attribute state array- Returns:
- The extracted natural id values. This is a normalized
-
extractNaturalIdFromEntity
Description copied from interface:NaturalIdMapping
Given an entity instance, extract the normalized natural id representation- Specified by:
extractNaturalIdFromEntity
in interfaceNaturalIdMapping
- Parameters:
entity
- The entity instance- Returns:
- The extracted natural id values
-
normalizeInput
Description copied from interface:NaturalIdMapping
Normalize a user-provided natural-id value into the representation Hibernate uses internally- Specified by:
normalizeInput
in interfaceNaturalIdMapping
- Parameters:
incoming
- The user-supplied value- Returns:
- The normalized, internal representation
-
validateInternalForm
Description copied from interface:NaturalIdMapping
Validates a natural id value(s) for the described natural-id based on the expected internal representation- Specified by:
validateInternalForm
in interfaceNaturalIdMapping
-
calculateHashCode
Description copied from interface:NaturalIdMapping
Calculate the hash-code of a natural-id value- Specified by:
calculateHashCode
in interfaceNaturalIdMapping
- Parameters:
value
- The natural-id value- Returns:
- The hash-code
-
getNaturalIdAttributes
Description copied from interface:NaturalIdMapping
The attribute(s) making up the natural-id.- Specified by:
getNaturalIdAttributes
in interfaceNaturalIdMapping
-
makeLoader
Description copied from interface:NaturalIdMapping
Make a loader capable of loading a single entity by natural-id- Specified by:
makeLoader
in interfaceNaturalIdMapping
-
makeMultiLoader
Description copied from interface:NaturalIdMapping
Make a loader capable of loading multiple entities by natural-id- Specified by:
makeMultiLoader
in interfaceNaturalIdMapping
-
getPartMappingType
Description copied from interface:ModelPart
The type for this part.- Specified by:
getPartMappingType
in interfaceModelPart
-
getJavaType
Description copied from interface:ModelPart
The Java type for this part. Generally equivalent toMappingType.getMappedJavaType()
relative toModelPart.getPartMappingType()
- Specified by:
getJavaType
in interfaceModelPart
-
getMappedJavaType
Description copied from interface:MappingType
The descriptor descriptor for the mapped Java type- Specified by:
getMappedJavaType
in interfaceMappingType
-
hasPartitionedSelectionMapping
public boolean hasPartitionedSelectionMapping()- Specified by:
hasPartitionedSelectionMapping
in interfaceModelPart
-
forEachSelectable
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
-
getJdbcTypeCount
public int getJdbcTypeCount()Description copied from interface:Bindable
The number of JDBC mappings- Specified by:
getJdbcTypeCount
in interfaceBindable
- Specified by:
getJdbcTypeCount
in interfaceJdbcMappingContainer
-
getJdbcMapping
- Specified by:
getJdbcMapping
in interfaceJdbcMappingContainer
-
forEachJdbcType
Description copied from interface:JdbcMappingContainer
Visit each JdbcMapping starting from the given offset- Specified by:
forEachJdbcType
in interfaceJdbcMappingContainer
-
getNumberOfFetchables
public int getNumberOfFetchables()Description copied from interface:FetchableContainer
The number of fetchables in the container- Specified by:
getNumberOfFetchables
in interfaceFetchableContainer
-
getFetchable
- Specified by:
getFetchable
in interfaceFetchableContainer
-
findSubPart
- Specified by:
findSubPart
in interfaceModelPartContainer
-
forEachSubPart
- Specified by:
forEachSubPart
in interfaceModelPartContainer
-
visitSubParts
- Specified by:
visitSubParts
in interfaceModelPartContainer
-