Package org.hibernate.metamodel.mapping
Interface NaturalIdMapping
-
- All Superinterfaces:
Bindable
,JdbcMappingContainer
,MappingModelExpressible
,ModelPart
,VirtualModelPart
- All Known Implementing Classes:
AbstractNaturalIdMapping
,CompoundNaturalIdMapping
,SimpleNaturalIdMapping
public interface NaturalIdMapping extends VirtualModelPart
Mapping for an entity's natural-id, if one is defined
-
-
Nested Class Summary
-
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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description int
calculateHashCode(Object value, SharedSessionContractImplementor session)
Calculate the hash-code of a natural-id valueObject
extractNaturalIdFromEntity(Object entity, SharedSessionContractImplementor session)
Given an entity instance, extract the normalized natural id representationObject
extractNaturalIdFromEntityState(Object[] state, SharedSessionContractImplementor session)
Given an array of "full entity state", extract the normalized natural id representationNaturalIdDataAccess
getCacheAccess()
Access to the natural-id's L2 cache access.List<SingularAttributeMapping>
getNaturalIdAttributes()
The attribute(s) making up the natural-id.default String
getPartName()
boolean
isMutable()
Whether the natural-id is immutable.NaturalIdLoader<?>
makeLoader(EntityMappingType entityDescriptor)
Make a loader capable of loading a single entity by natural-idMultiNaturalIdLoader<?>
makeMultiLoader(EntityMappingType entityDescriptor)
Make a loader capable of loading multiple entities by natural-idObject
normalizeInput(Object incoming, SharedSessionContractImplementor session)
Normalize a user-provided natural-id value into the representation Hibernate uses internallyvoid
validateInternalForm(Object naturalIdValue, SharedSessionContractImplementor session)
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 database-
Methods inherited from interface org.hibernate.metamodel.mapping.Bindable
disassemble, forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachJdbcValue, getJdbcMappings, getJdbcTypeCount
-
Methods inherited from interface org.hibernate.metamodel.mapping.JdbcMappingContainer
forEachJdbcType
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPart
applySqlSelections, applySqlSelections, areEqual, asAttributeMapping, breakDownJdbcValues, createDomainResult, findContainingEntityMapping, forEachSelectable, forEachSelectable, getJavaType, getNavigableRole, getPartMappingType
-
-
-
-
Field Detail
-
PART_NAME
static final String PART_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getNaturalIdAttributes
List<SingularAttributeMapping> getNaturalIdAttributes()
The attribute(s) making up the natural-id.
-
isMutable
boolean isMutable()
Whether the natural-id is immutable. This is the same as saying that none of the attributes are mutable
-
getPartName
default String getPartName()
- Specified by:
getPartName
in interfaceModelPart
-
getCacheAccess
NaturalIdDataAccess getCacheAccess()
Access to the natural-id's L2 cache access. Returns null if the natural-id is not configured for caching
-
verifyFlushState
void verifyFlushState(Object id, Object[] currentState, Object[] loadedState, SharedSessionContractImplementor session)
Verify the natural-id value(s) we are about to flush to the database
-
extractNaturalIdFromEntityState
Object extractNaturalIdFromEntityState(Object[] state, SharedSessionContractImplementor session)
Given an array of "full entity state", extract the normalized natural id representation- Parameters:
state
- The attribute state array- Returns:
- The extracted natural id values. This is a normalized
-
extractNaturalIdFromEntity
Object extractNaturalIdFromEntity(Object entity, SharedSessionContractImplementor session)
Given an entity instance, extract the normalized natural id representation- Parameters:
entity
- The entity instance- Returns:
- The extracted natural id values
-
normalizeInput
Object normalizeInput(Object incoming, SharedSessionContractImplementor session)
Normalize a user-provided natural-id value into the representation Hibernate uses internally- Parameters:
incoming
- The user-supplied value- Returns:
- The normalized, internal representation
-
validateInternalForm
void validateInternalForm(Object naturalIdValue, SharedSessionContractImplementor session)
Validates a natural id value(s) for the described natural-id based on the expected internal representation
-
calculateHashCode
int calculateHashCode(Object value, SharedSessionContractImplementor session)
Calculate the hash-code of a natural-id value- Parameters:
value
- The natural-id value- Returns:
- The hash-code
-
makeLoader
NaturalIdLoader<?> makeLoader(EntityMappingType entityDescriptor)
Make a loader capable of loading a single entity by natural-id
-
makeMultiLoader
MultiNaturalIdLoader<?> makeMultiLoader(EntityMappingType entityDescriptor)
Make a loader capable of loading multiple entities by natural-id
-
-