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 classEntityIdentifierMapping.NatureThe 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 StringID_ROLE_NAMEstatic StringLEGACY_ID_NAME
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description StringgetAttributeName()The name of the attribute defining the id, if oneObjectgetIdentifier(Object entity)Extract the identifier from an instance of the entitydefault ObjectgetIdentifier(Object entity, MergeContext mergeContext)Extract the identifier from an instance of the entity It's supposed to be use during the merging processdefault ObjectgetIdentifierIfNotUnsaved(Object entity, SharedSessionContractImplementor session)Return the identifier of the persistent or transient object, or throw an exception if the instance is "unsaved"EntityIdentifierMapping.NaturegetNature()default StringgetPartName()The local part name, which is generally the unqualified role nameIdentifierValuegetUnsavedStrategy()The strategy for distinguishing between detached and transient state based on the identifier mappingObjectinstantiate()Instantiate an instance of the identifier.default booleanisEntityIdentifierMapping()static booleanmatchesRoleName(String name)voidsetIdentifier(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, asBasicValuedModelPart, 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:ModelPartThe local part name, which is generally the unqualified role name- Specified by:
getPartNamein 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
-
getIdentifier
default Object getIdentifier(Object entity, MergeContext mergeContext)
Extract the identifier from an instance of the entity It's supposed to be use during the merging process
-
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:
isEntityIdentifierMappingin interfaceModelPart
-
-