Class SimpleNaturalIdMapping
java.lang.Object
org.hibernate.metamodel.mapping.internal.AbstractNaturalIdMapping
org.hibernate.metamodel.mapping.internal.SimpleNaturalIdMapping
- All Implemented Interfaces:
BasicValuedMapping,Bindable,JdbcMappingContainer,MappingModelExpressible,ModelPart,NaturalIdMapping,SqlExpressible,ValueMapping,VirtualModelPart,JavaType.CoercionContext,JavaTypedExpressible
public class SimpleNaturalIdMapping
extends AbstractNaturalIdMapping
implements JavaType.CoercionContext, BasicValuedMapping
Single-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
ConstructorsConstructorDescriptionSimpleNaturalIdMapping(SingularAttributeMapping attribute, EntityMappingType declaringType, MappingModelCreationProcess creationProcess) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToCacheKey(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.<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.intcalculateHashCode(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 ofJinto its simple pieces.extractNaturalIdFromEntity(Object entity) Given an entity instance, extract the normalized natural id representationextractNaturalIdFromEntityState(Object[] state) Given an array of "full entity state", extract the normalized natural id representation<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).intforEachJdbcType(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.intforEachSelectable(int offset, SelectableConsumer consumer) Visits each selectable mapping with the selectable index offset by the given value.JavaType<?> The Java type for this part.Anything that is expressible at the SQL AST level would be of basic type.getJdbcMapping(int index) intThe number of JDBC mappingsDescriptor for the type of this mappingThe attribute(s) making up the natural-id.The type for this part.booleanmakeLoader(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-idnormalizeInput(Object incoming) Normalize a user-provided natural-id value into the representation Hibernate uses internallyvoidvalidateInternalForm(Object naturalIdValue) Validates a natural id value(s) for the described natural-id based on the expected internal representationvoidverifyFlushState(Object id, Object[] currentState, Object[] loadedState, SharedSessionContractImplementor session) Verify the natural-id value(s) we are about to flush to the databaseMethods inherited from class org.hibernate.metamodel.mapping.internal.AbstractNaturalIdMapping
findContainingEntityMapping, getCacheAccess, getDeclaringType, getNavigableRole, isMutableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.metamodel.mapping.Bindable
forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachJdbcValue, forEachJdbcValueMethods inherited from interface org.hibernate.metamodel.mapping.ModelPart
areEqual, asBasicValuedModelPart, asEntityMappingType, breakDownJdbcValues, decompose, decompose, forEachSelectable, isEntityIdentifierMappingMethods inherited from interface org.hibernate.metamodel.mapping.NaturalIdMapping
getPartNameMethods inherited from interface org.hibernate.metamodel.mapping.ValueMapping
getExpressibleJavaType, treatAsMethods inherited from interface org.hibernate.metamodel.mapping.VirtualModelPart
isVirtual
-
Constructor Details
-
SimpleNaturalIdMapping
public SimpleNaturalIdMapping(SingularAttributeMapping attribute, EntityMappingType declaringType, MappingModelCreationProcess creationProcess)
-
-
Method Details
-
getAttribute
-
extractNaturalIdFromEntityState
Description copied from interface:NaturalIdMappingGiven an array of "full entity state", extract the normalized natural id representation- Specified by:
extractNaturalIdFromEntityStatein interfaceNaturalIdMapping- Parameters:
state- The attribute state array- Returns:
- The extracted natural id values. This is a normalized
-
extractNaturalIdFromEntity
Description copied from interface:NaturalIdMappingGiven an entity instance, extract the normalized natural id representation- Specified by:
extractNaturalIdFromEntityin interfaceNaturalIdMapping- Parameters:
entity- The entity instance- Returns:
- The extracted natural id values
-
validateInternalForm
Description copied from interface:NaturalIdMappingValidates a natural id value(s) for the described natural-id based on the expected internal representation- Specified by:
validateInternalFormin interfaceNaturalIdMapping
-
calculateHashCode
Description copied from interface:NaturalIdMappingCalculate the hash-code of a natural-id value- Specified by:
calculateHashCodein interfaceNaturalIdMapping- Parameters:
value- The natural-id value- Returns:
- The hash-code
-
normalizeInput
Description copied from interface:NaturalIdMappingNormalize a user-provided natural-id value into the representation Hibernate uses internally- Specified by:
normalizeInputin interfaceNaturalIdMapping- Parameters:
incoming- The user-supplied value- Returns:
- The normalized, internal representation
-
getNaturalIdAttributes
Description copied from interface:NaturalIdMappingThe attribute(s) making up the natural-id.- Specified by:
getNaturalIdAttributesin interfaceNaturalIdMapping
-
getPartMappingType
Description copied from interface:ModelPartThe type for this part.- Specified by:
getPartMappingTypein interfaceModelPart
-
getJavaType
Description copied from interface:ModelPartThe Java type for this part. Generally equivalent toMappingType.getMappedJavaType()relative toModelPart.getPartMappingType()- Specified by:
getJavaTypein interfaceModelPart
-
forEachSelectable
Description copied from interface:ModelPartVisits each selectable mapping with the selectable index offset by the given value. Returns the amount of jdbc types that have been visited.- Specified by:
forEachSelectablein interfaceModelPart
-
getJdbcTypeCount
public int getJdbcTypeCount()Description copied from interface:BindableThe number of JDBC mappings- Specified by:
getJdbcTypeCountin interfaceBasicValuedMapping- Specified by:
getJdbcTypeCountin interfaceBindable- Specified by:
getJdbcTypeCountin interfaceJdbcMappingContainer
-
getJdbcMapping
- Specified by:
getJdbcMappingin interfaceBasicValuedMapping- Specified by:
getJdbcMappingin interfaceJdbcMappingContainer- Specified by:
getJdbcMappingin interfaceSqlExpressible
-
getSingleJdbcMapping
- Specified by:
getSingleJdbcMappingin interfaceBasicValuedMapping- Specified by:
getSingleJdbcMappingin interfaceJdbcMappingContainer
-
getJdbcMapping
Description copied from interface:SqlExpressibleAnything that is expressible at the SQL AST level would be of basic type.- Specified by:
getJdbcMappingin interfaceBasicValuedMapping- Specified by:
getJdbcMappingin interfaceSqlExpressible
-
forEachJdbcType
Description copied from interface:JdbcMappingContainerVisit each JdbcMapping starting from the given offset- Specified by:
forEachJdbcTypein interfaceJdbcMappingContainer
-
makeLoader
Description copied from interface:NaturalIdMappingMake a loader capable of loading a single entity by natural-id- Specified by:
makeLoaderin interfaceNaturalIdMapping
-
makeMultiLoader
Description copied from interface:NaturalIdMappingMake a loader capable of loading multiple entities by natural-id- Specified by:
makeMultiLoaderin interfaceNaturalIdMapping
-
getTypeConfiguration
- Specified by:
getTypeConfigurationin interfaceJavaType.CoercionContext
-
asAttributeMapping
- Specified by:
asAttributeMappingin interfaceModelPart
-
hasPartitionedSelectionMapping
public boolean hasPartitionedSelectionMapping()- Specified by:
hasPartitionedSelectionMappingin interfaceModelPart
-
getMappedType
Description copied from interface:ValueMappingDescriptor for the type of this mapping- Specified by:
getMappedTypein interfaceValueMapping
-