Package org.hibernate.metamodel.mapping
Interface EntityIdentifierMapping
-
- All Superinterfaces:
Bindable
,JavaTypedExpressible
,JdbcMappingContainer
,MappingModelExpressible
,ModelPart
,SelectableMappings
,ValuedModelPart
,ValueMapping
- All Known Subinterfaces:
AggregatedIdentifierMapping
,BasicEntityIdentifierMapping
,CompositeIdentifierMapping
,NonAggregatedIdentifierMapping
,SingleAttributeIdentifierMapping
- All Known Implementing Classes:
AbstractCompositeIdentifierMapping
,AnonymousTupleBasicEntityIdentifierMapping
,AnonymousTupleEmbeddedEntityIdentifierMapping
,AnonymousTupleNonAggregatedEntityIdentifierMapping
,BasicEntityIdentifierMappingImpl
,EmbeddedIdentifierMappingImpl
,InverseNonAggregatedIdentifierMapping
,NonAggregatedIdentifierMappingImpl
public interface EntityIdentifierMapping extends ValuedModelPart
Describes the mapping of an entity's identifier.- See Also:
Id
,EmbeddedId
,EntityIdentifierMapping.Nature
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
EntityIdentifierMapping.Nature
The style of identifier used.-
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 Modifier and Type Field Description static String
ID_ROLE_NAME
static String
LEGACY_ID_NAME
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description String
getAttributeName()
The name of the attribute defining the id, if oneObject
getIdentifier(Object entity)
Extract the identifier from an instance of the entitydefault Object
getIdentifierIfNotUnsaved(Object entity, SharedSessionContractImplementor session)
Return the identifier of the persistent or transient object, or throw an exception if the instance is "unsaved"EntityIdentifierMapping.Nature
getNature()
default String
getPartName()
The local part name, which is generally the unqualified role nameIdentifierValue
getUnsavedStrategy()
The strategy for distinguishing between detached and transient state based on the identifier mappingObject
instantiate()
Instantiate an instance of the identifier.default boolean
isEntityIdentifierMapping()
static boolean
matchesRoleName(String name)
void
setIdentifier(Object entity, Object id, SharedSessionContractImplementor session)
Inject an identifier value into an instance of the entity-
Methods inherited from interface org.hibernate.metamodel.mapping.Bindable
addToCacheKey, disassemble, forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachJdbcValue, forEachJdbcValue, forEachJdbcValue
-
Methods inherited from interface org.hibernate.type.descriptor.java.JavaTypedExpressible
addToCacheKey
-
Methods inherited from interface org.hibernate.metamodel.mapping.JdbcMappingContainer
forEachJdbcType, getJdbcMapping
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPart
applySqlSelections, applySqlSelections, areEqual, asAttributeMapping, asEntityMappingType, breakDownJdbcValues, breakDownJdbcValues, createDomainResult, decompose, decompose, findContainingEntityMapping, getJavaType, getNavigableRole, getPartMappingType, hasPartitionedSelectionMapping, isVirtual
-
Methods inherited from interface org.hibernate.metamodel.mapping.SelectableMappings
getSelectable
-
Methods inherited from interface org.hibernate.metamodel.mapping.ValuedModelPart
forEachInsertable, forEachNonFormula, forEachSelectable, forEachSelectable, forEachUpdatable, getContainingTableExpression, getJdbcTypeCount, getSingleJdbcMapping
-
Methods inherited from interface org.hibernate.metamodel.mapping.ValueMapping
getExpressibleJavaType, getMappedType, treatAs
-
-
-
-
Field Detail
-
ID_ROLE_NAME
static final String ID_ROLE_NAME
- See Also:
- Constant Field Values
-
LEGACY_ID_NAME
static final String LEGACY_ID_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
matchesRoleName
static boolean matchesRoleName(String name)
-
getPartName
default String getPartName()
Description copied from interface:ModelPart
The local part name, which is generally the unqualified role name- Specified by:
getPartName
in interfaceModelPart
-
getNature
EntityIdentifierMapping.Nature getNature()
- See Also:
EntityIdentifierMapping.Nature
-
getAttributeName
String getAttributeName()
The name of the attribute defining the id, if one
-
getUnsavedStrategy
IdentifierValue getUnsavedStrategy()
The strategy for distinguishing between detached and transient state based on the identifier mapping
-
instantiate
Object instantiate()
Instantiate an instance of the identifier.- API Note:
- This is really only valid on composite identifiers
-
getIdentifier
Object getIdentifier(Object entity)
Extract the identifier from an instance of the entity
-
getIdentifierIfNotUnsaved
default Object getIdentifierIfNotUnsaved(Object entity, SharedSessionContractImplementor session)
Return the identifier of the persistent or transient object, or throw an exception if the instance is "unsaved"Used by OneToOneType and ManyToOneType to determine what id value should be used for an object that may or may not be associated with the session. This does a "best guess" using any/all info available to use (not just the EntityEntry).
- Parameters:
entity
- The entity instancesession
- The session- Returns:
- The identifier
- Throws:
TransientObjectException
- if the entity is transient (does not yet have an identifier)- Since:
- 6.1.1
- See Also:
ForeignKeys.getEntityIdentifierIfNotUnsaved(String, Object, SharedSessionContractImplementor)
-
setIdentifier
void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session)
Inject an identifier value into an instance of the entity
-
isEntityIdentifierMapping
default boolean isEntityIdentifierMapping()
- Specified by:
isEntityIdentifierMapping
in interfaceModelPart
-
-