Interface EntityPersister
-
- All Superinterfaces:
AttributeSource
,Bindable
,Discriminable
,EntityMappingType
,EntityMutationTarget
,EntityValuedModelPart
,FetchableContainer
,FilterRestrictable
,JdbcMappingContainer
,Loadable
,ManagedMappingType
,MappingModelExpressible
,MappingType
,ModelPart
,ModelPartContainer
,MutationTarget<EntityTableMapping>
,Restrictable
,RootTableGroupProducer
,SoftDeletableModelPart
,TableGroupProducer
,WhereRestrictable
- All Known Subinterfaces:
DeprecatedEntityStuff
,Loadable
,Lockable
,OuterJoinLoadable
,PostInsertIdentityPersister
,Queryable
,SQLLoadable
,UniqueKeyLoadable
- All Known Implementing Classes:
AbstractEntityPersister
,JoinedSubclassEntityPersister
,MockEntityPersister
,ProcessorSessionFactory.EntityPersister
,SingleTableEntityPersister
,UnionSubclassEntityPersister
public interface EntityPersister extends EntityMappingType, EntityMutationTarget, RootTableGroupProducer, AttributeSource
A strategy for persisting a mapped entity class. AnEntityPersister
orchestrates rendering of the SQL statements corresponding to basic lifecycle events, includinginsert
,update
, anddelete
statements, and their execution via JDBC.Concrete implementations of this interface handle the single table, joined, and union inheritance mapping strategies, and to a certain extent abstract the details of those mappings from collaborators.
This interface defines a contract between the persistence strategy and the
session
. It does not define operations that are required for querying, nor for loading by outer join.Unless a custom
PersisterFactory
is used, it is expected that implementations ofEntityPersister
define a constructor accepting the following arguments:-
PersistentClass
- describes the metadata about the entity to be handled by the persister -
EntityDataAccess
- the second level caching strategy for this entity -
NaturalIdDataAccess
- the second level caching strategy for any natural id defined for this entity -
RuntimeModelCreationContext
- access to additional information useful while constructing the persister.
- See Also:
PersisterFactory
,PersisterClassResolver
-
-
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.EntityMappingType
EntityMappingType.ConstraintOrderedTableConsumer
-
Nested classes/interfaces inherited from interface org.hibernate.metamodel.mapping.ModelPart
ModelPart.JdbcValueBiConsumer<X,Y>, ModelPart.JdbcValueConsumer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default void
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
afterInitialize(Object entity, SharedSessionContractImplementor session)
Called just after the entities properties have been initializedvoid
afterReassociate(Object entity, SharedSessionContractImplementor session)
Called just after the entity has been reassociated with the sessiondefault <X,Y>
intbreakDownJdbcValues(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.CacheEntry
buildCacheEntry(Object entity, Object[] state, Object version, SharedSessionContractImplementor session)
default boolean
canExtractIdOutOfEntity()
Deprecated.This feature is no longer supportedboolean
canReadFromCache()
boolean
canUseReferenceCacheEntries()
boolean
canWriteToCache()
Object
createProxy(Object id, SharedSessionContractImplementor session)
Create a new proxy instancedefault void
delete(Object id, Object version, Object object, SharedSessionContractImplementor session)
Deprecated, for removal: This API element is subject to removal in a future version.int[]
findDirty(Object[] currentState, Object[] previousState, Object owner, SharedSessionContractImplementor session)
Compare the two snapshots to determine if they represent dirty state.int[]
findModified(Object[] old, Object[] current, Object object, SharedSessionContractImplementor session)
Compare the two snapshots to determine if they represent modified state.default Object
forceVersionIncrement(Object id, Object currentVersion, boolean batching, SharedSessionContractImplementor session)
Object
forceVersionIncrement(Object id, Object currentVersion, SharedSessionContractImplementor session)
default AttributeMapping
getAttributeMapping(int position)
Retrieve an attribute mapping by position, relative to all attributesdefault int
getBatchSize()
The batch size for batch loading.default BytecodeEnhancementMetadata
getBytecodeEnhancementMetadata()
EntityDataAccess
getCacheAccessStrategy()
Get the cache (optional operation)CacheEntryStructure
getCacheEntryStructure()
Get the cache structureClassMetadata
getClassMetadata()
Deprecated.This operation is no longer called by Hibernate.Class<?>
getConcreteProxyClass()
Get the proxy interface that instances of this concrete class will be cast to (optional operation).Object
getCurrentVersion(Object id, SharedSessionContractImplementor session)
Get the current version of the object, or return null if there is no row for the given identifier.Object[]
getDatabaseSnapshot(Object id, SharedSessionContractImplementor session)
Get the current database state of the object, in a "hydrated" form, without resolving identifiers.DeleteCoordinator
getDeleteCoordinator()
Get the delete coordinator instance.EntityEntryFactory
getEntityEntryFactory()
Get the EntityEntryFactory indicated for the entity mapped by this persister.default EntityMappingType
getEntityMappingType()
The descriptor of the entity that is the type for this partEntityMetamodel
getEntityMetamodel()
Retrieve the underlying entity metamodel instance.String
getEntityName()
The entity name which this persister maps.SessionFactoryImplementor
getFactory()
Return theSessionFactory
to which this persister belongs.FilterAliasGenerator
getFilterAliasGenerator(String rootAlias)
default FilterAliasGenerator
getFilterAliasGenerator(TableGroup rootTableGroup)
default List<? extends ModelPart>
getGeneratedProperties(EventType timing)
default Generator
getGenerator()
Object
getIdByUniqueKey(Object key, String uniquePropertyName, SharedSessionContractImplementor session)
Object
getIdentifier(Object entity, SharedSessionContractImplementor session)
Get the identifier of an instance from the object's identifier property.default Object
getIdentifier(Object entity, MergeContext mergeContext)
Get the identifier of an instance from the object's identifier property.String[]
getIdentifierColumnNames()
IdentifierGenerator
getIdentifierGenerator()
Deprecated.usegetGenerator()
String
getIdentifierPropertyName()
Get the name of the identifier property (or return null) - need not return the name of an actual Java propertyType
getIdentifierType()
Get the identifier typeString
getIdentitySelectString()
Get the database-specific SQL command to retrieve the last generated IDENTITY value.InsertCoordinator
getInsertCoordinator()
Get the insert coordinator instance.default List<? extends ModelPart>
getInsertGeneratedProperties()
BytecodeEnhancementMetadata
getInstrumentationMetadata()
Class<?>
getMappedClass()
The persistent class, or nulldefault UpdateCoordinator
getMergeCoordinator()
Get the merge coordinator instance.default MultiNaturalIdLoader<?>
getMultiNaturalIdLoader()
Access to performing multi-value natural-id database selection.NaturalIdDataAccess
getNaturalIdCacheAccessStrategy()
Get the NaturalId cache (optional operation)int[]
getNaturalIdentifierProperties()
If the entity defines a natural id, that is, ifhasNaturalIdentifier()
returnstrue
, the indices of the properties which make up the natural id.Object
getNaturalIdentifierSnapshot(Object id, SharedSessionContractImplementor session)
Retrieve the current state of the natural-id properties from the database.default NaturalIdLoader<?>
getNaturalIdLoader()
Access to performing natural-id database selection.CascadeStyle[]
getPropertyCascadeStyles()
Get the cascade styles of the properties (optional operation)boolean[]
getPropertyCheckability()
Get the "checkability" of the properties of this class (is the property dirty checked, does the cache need to be updated)boolean[]
getPropertyInsertability()
Get the "insertability" of the properties of this class (does the property appear in an SQL INSERT)boolean[]
getPropertyLaziness()
String[]
getPropertyNames()
Get the names of the class properties - doesn't have to be the names of the actual Java properties (used for XML generation only)boolean[]
getPropertyNullability()
Get the nullability of the properties of this classString[]
getPropertySpaces()
Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class only.Type
getPropertyType(String propertyName)
Deprecated, for removal: This API element is subject to removal in a future version.Type[]
getPropertyTypes()
Get the Hibernate types of the class propertiesboolean[]
getPropertyUpdateability()
Get the "updateability" of the properties of this class (does the property appear in an SQL UPDATE)Object
getPropertyValue(Object object, int i)
Deprecated.UsegetValue(java.lang.Object, int)
insteadObject
getPropertyValue(Object object, String propertyName)
Get the value of a particular propertyObject[]
getPropertyValues(Object object)
Deprecated.UsegetValues(java.lang.Object)
insteadObject[]
getPropertyValuesToInsert(Object object, Map<Object,Object> mergeMap, SharedSessionContractImplementor session)
Return the values of the insertable properties of the object (including backrefs)boolean[]
getPropertyVersionability()
Get the "versionability" of the properties of this class (is the property optimistic-locked)Serializable[]
getQuerySpaces()
Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class and its subclasses.EntityRepresentationStrategy
getRepresentationStrategy()
Describes how the entity is represented in the application's domain model.String
getRootEntityName()
Returns an object that identifies the space in which identifiers of this entity hierarchy are unique.String[]
getRootTableKeyColumnNames()
The names of the primary key columns in the root table.String
getSelectByUniqueKeyString(String propertyName)
Get a SQL select string that performs a select based on a unique key determined by the given property name.default String
getSelectByUniqueKeyString(String[] propertyNames)
Get a SQL select string that performs a select based on a unique key determined by the given property names.String
getSelectByUniqueKeyString(String[] propertyNames, String[] columnNames)
default String
getSqlAliasStem()
Get the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generatedSqmMultiTableInsertStrategy
getSqmMultiTableInsertStrategy()
SqmMultiTableMutationStrategy
getSqmMultiTableMutationStrategy()
The strategy to use for SQM mutation statements where the target entity has multiple tables.EntityPersister
getSubclassEntityPersister(Object instance, SessionFactoryImplementor factory)
Obtain theEntityPersister
for the concrete class of the given entity instance which participates in a mapped inheritance hierarchy with this persister.default String[]
getSynchronizationSpaces()
The table names this entity needs to be synchronized against.default String[]
getSynchronizedQuerySpaces()
Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class and its subclasses.UpdateCoordinator
getUpdateCoordinator()
Get the update coordinator instance.default List<? extends ModelPart>
getUpdateGeneratedProperties()
default Object
getValue(Object object, int i)
Extract a specific attribute value from the entity instance, by positiondefault Object[]
getValues(Object object)
Extract the individual attribute values from the entity instanceObject
getVersion(Object object)
Get the version number (or timestamp) from the object's version property.default BeforeExecutionGenerator
getVersionGenerator()
default VersionJavaType<Object>
getVersionJavaType()
int
getVersionProperty()
IfisVersioned()
, then what is the index of the property holding the locking value.BasicType<?>
getVersionType()
IfisVersioned()
, then what is the type of the property holding the locking value.boolean
hasCache()
Deprecated.UsecanReadFromCache()
and/orcanWriteToCache()
depending on needdefault boolean
hasCascadeDelete()
Determine whether this entity has any delete cascading.boolean
hasCascades()
Determine whether this entity has any (non-none) cascading.boolean
hasCollectionNotReferencingPK()
Determine whether this entity contains references to persistent collections not referencing the primary key.boolean
hasCollections()
Determine whether this entity contains references to persistent collections.boolean
hasFilterForLoadByKey()
boolean
hasIdentifierProperty()
Determine whether the entity has a particular property holding the identifier value.boolean
hasInsertGeneratedProperties()
Does this entity define any properties as being database generated on insert?boolean
hasLazyProperties()
Determine whether this entity defines any lazy properties (when bytecode instrumentation is enabled).boolean
hasMutableProperties()
Determine whether any properties of this entity are considered mutable.boolean
hasNaturalIdCache()
Does this class have a natural id cacheboolean
hasNaturalIdentifier()
Determine whether this entity defines a natural identifier.default boolean
hasOwnedCollections()
Determine whether this entity has any owned collections.boolean
hasProxy()
Determine whether this entity supports dynamic proxies.boolean
hasSubselectLoadableCollections()
Determine whether this entity contains references to persistent collections which are fetchable by subselect?boolean
hasUninitializedLazyProperties(Object object)
Does the given instance have any uninitialized lazy properties?boolean
hasUpdateGeneratedProperties()
Does this entity define any properties as being database generated on update?boolean
implementsLifecycle()
Does the class implement theLifecycle
interface?default Object
initializeEnhancedEntityUsedAsProxy(Object entity, String nameOfAttributeBeingAccessed, SharedSessionContractImplementor session)
Called fromEnhancementAsProxyLazinessInterceptor
to trigger load of the entity's non-lazy state as well as the named attribute we are accessing if it is still uninitialized after fetching non-lazy state.default Object
insert(Object[] fields, Object object, SharedSessionContractImplementor session)
Deprecated, for removal: This API element is subject to removal in a future version.default void
insert(Object id, Object[] fields, Object object, SharedSessionContractImplementor session)
Deprecated, for removal: This API element is subject to removal in a future version.Object
instantiate(Object id, SharedSessionContractImplementor session)
Create a class instance initialized with the given identifierdefault boolean
isBatchLoadable()
Is batch loading enabled?boolean
isCacheInvalidationRequired()
Should we always invalidate the cache instead of recaching updated stateboolean
isIdentifierAssignedByInsert()
Are identifiers of this entity assigned known before the insert execution? Or, are they generated (in the database) by the insert execution.boolean
isInherited()
Determine whether the entity is inherited one or more other entities.boolean
isInstance(Object object)
Is the given object an instance of this entity?boolean
isInstrumented()
Has the class actually been bytecode instrumented?boolean
isLazyPropertiesCacheable()
Should lazy properties of this entity be cached?boolean
isMutable()
Determine whether instances of this entity are considered mutable.default boolean
isPropertySelectable(int propertyNumber)
boolean
isSelectBeforeUpdateRequired()
Is select snapshot before update enabled?boolean
isSubclassEntityName(String entityName)
Determine whether the given name represents a subclass entity (or this entity itself) of the entity mapped by this persister.Boolean
isTransient(Object object, SharedSessionContractImplementor session)
Is this a new transient instance?boolean
isVersioned()
Determine whether optimistic locking by column is enabled for this entity.boolean
isVersionPropertyGenerated()
Does this entity contain a version property that is defined to be database generated?Object
load(Object id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session)
Load an instance of the persistent class.default Object
load(Object id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session, Boolean readOnly)
Deprecated.Object
load(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session)
Load an instance of the persistent class.default Object
load(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session, Boolean readOnly)
default Object
loadByUniqueKey(String propertyName, Object uniqueKey, SharedSessionContractImplementor session)
Load an instance of the persistent class, by a unique key other than the primary key.Object
loadEntityIdByNaturalId(Object[] naturalIdValues, LockOptions lockOptions, SharedSessionContractImplementor session)
Load the id for the entity based on the natural id.void
lock(Object id, Object version, Object object, LockMode lockMode, EventSource session)
Do a version check (optional operation)void
lock(Object id, Object version, Object object, LockOptions lockOptions, EventSource session)
Do a version check (optional operation)default void
merge(Object id, Object[] fields, int[] dirtyFields, boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object object, Object rowId, SharedSessionContractImplementor session)
Deprecated, for removal: This API element is subject to removal in a future version.List<?>
multiLoad(Object[] ids, EventSource session, MultiIdLoadOptions loadOptions)
Performs a load of multiple entities (of this type) by identifier simultaneously.void
postInstantiate()
Finish the initialization of this object.default void
prepareLoaders()
Prepare loaders associated with the persister.default void
processInsertGeneratedProperties(Object id, Object entity, Object[] state, SharedSessionContractImplementor session)
Deprecated, for removal: This API element is subject to removal in a future version.default void
processInsertGeneratedProperties(Object id, Object entity, Object[] state, GeneratedValues generatedValues, SharedSessionContractImplementor session)
Retrieve the values of any insert generated properties through the providedGeneratedValues
or, when that's not available, by selecting them back from the database, injecting these generated values into the given entity as well as writing this state to thePersistenceContext
.default void
processUpdateGeneratedProperties(Object id, Object entity, Object[] state, SharedSessionContractImplementor session)
Deprecated, for removal: This API element is subject to removal in a future version.void
processUpdateGeneratedProperties(Object id, Object entity, Object[] state, GeneratedValues generatedValues, SharedSessionContractImplementor session)
Retrieve the values of any update generated properties through the providedGeneratedValues
or, when that's not available, by selecting them back from the database, injecting these generated values into the given entity as well as writing this state to thePersistenceContext
.void
resetIdentifier(Object entity, Object currentId, Object currentVersion, SharedSessionContractImplementor session)
Set the identifier and version of the given instance back to its "unsaved" value, that is, the value it had before it was made persistent.int[]
resolveAttributeIndexes(String[] attributeNames)
Converts an array of attribute names to a set of indexes, according to the entity metamodeldefault int[]
resolveDirtyAttributeIndexes(Object[] values, Object[] loadedState, String[] attributeNames, SessionImplementor session)
LikeresolveAttributeIndexes(String[])
but also always returns mutable attributesvoid
setIdentifier(Object entity, Object id, SharedSessionContractImplementor session)
Inject the identifier value into the given entity.void
setPropertyValue(Object object, int i, Object value)
Deprecated.void
setPropertyValues(Object object, Object[] values)
Deprecated.UsesetValues(java.lang.Object, java.lang.Object[])
insteaddefault void
setValue(Object object, int i, Object value)
Inject a specific attribute value into the entity instance, by positiondefault void
setValues(Object object, Object[] values)
Inject the attribute values into the entity instanceboolean
storeDiscriminatorInShallowQueryCacheLayout()
Iterable<UniqueKeyEntry>
uniqueKeyEntries()
default void
update(Object id, Object[] fields, int[] dirtyFields, boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object object, Object rowId, SharedSessionContractImplementor session)
Deprecated, for removal: This API element is subject to removal in a future version.boolean
useShallowQueryCacheLayout()
default void
visitQuerySpaces(Consumer<String> querySpaceConsumer)
Visit each "query space" for the mapped entity.-
Methods inherited from interface org.hibernate.persister.walking.spi.AttributeSource
getPropertyIndex
-
Methods inherited from interface org.hibernate.metamodel.mapping.Bindable
forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachJdbcValue, forEachJdbcValue
-
Methods inherited from interface org.hibernate.metamodel.mapping.EntityMappingType
applyBaseRestrictions, applyDiscriminator, applyFilterRestrictions, applyWhereRestrictions, asEntityMappingType, createPrimaryTableReference, createRootTableGroup, createTableReferenceJoin, extractConcreteTypeStateValues, findContainingEntityMapping, findDeclaredAttributeMapping, findSubPart, findSubTypesSubPart, forEachAttributeMapping, getAttributeMappings, getContributor, getDeclaredAttributeMappings, getDiscriminatorMapping, getDiscriminatorSQLValue, getDiscriminatorValue, getEntityPersister, getFetchable, getIdentifierMapping, getIdentifierMappingForJoin, getIdentifierTableDetails, getJavaType, getJdbcTypeCount, getMappedJavaType, getMappedSuperclass, getMappedTableDetails, getNaturalIdMapping, getNumberOfAttributeMappings, getNumberOfDeclaredAttributeMappings, getNumberOfFetchables, getPartMappingType, getPartName, getRootEntityDescriptor, getRootPathName, getRowIdMapping, getSoftDeleteMapping, getSoftDeleteTableDetails, getSubclassEntityNames, getSubclassId, getSubMappingTypes, getSuperMappingType, getVersionMapping, hasSubclasses, hasWhereRestrictions, isAbstract, isAffectedByEnabledFetchProfiles, isAffectedByEnabledFilters, isAffectedByEntityGraph, isConcreteProxy, isExplicitPolymorphism, isTypeOrSuperType, isTypeOrSuperType, optimisticLockStyle, pruneForSubclasses, pruneForSubclasses, resolveConcreteProxyTypeForId, visitAttributeMappings, visitConstraintOrderedTables, visitDeclaredAttributeMappings, visitSubTypeAttributeMappings, visitSuperTypeAttributeMappings
-
Methods inherited from interface org.hibernate.persister.entity.mutation.EntityMutationTarget
getIdentifierDescriptor, getIdentifierTableMapping, getIdentityInsertDelegate, getInsertDelegate, getMutationDelegate, getTargetPart, getUpdateDelegate, hasSkippableTables
-
Methods inherited from interface org.hibernate.metamodel.mapping.EntityValuedModelPart
applySqlSelections, applySqlSelections, createDomainResult, disassemble, findSubPart, forEachDisassembledJdbcValue, forEachJdbcType, forEachJdbcValue, forEachSubPart, visitSubParts
-
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.FilterRestrictable
applyFilterRestrictions
-
Methods inherited from interface org.hibernate.metamodel.mapping.JdbcMappingContainer
getJdbcMapping, getSingleJdbcMapping
-
Methods inherited from interface org.hibernate.loader.ast.spi.Loadable
isAffectedByEnabledFilters, isAffectedByInfluencers, isAffectedByInfluencers, isNotAffectedByInfluencers
-
Methods inherited from interface org.hibernate.metamodel.mapping.ManagedMappingType
anyRequiresAggregateColumnWriter, findAttributeMapping, forEachAttributeMapping, hasPartitionedSelectionMapping, isAffectedByEnabledFilters
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPart
areEqual, asAttributeMapping, asBasicValuedModelPart, breakDownJdbcValues, decompose, decompose, forEachSelectable, forEachSelectable, getNavigableRole, isEntityIdentifierMapping, isVirtual
-
Methods inherited from interface org.hibernate.metamodel.mapping.ModelPartContainer
findByPath, findByPath, forEachSubPart
-
Methods inherited from interface org.hibernate.sql.model.MutationTarget
forEachMutableTable, forEachMutableTableReverse, getIdentifierTableName, getNavigableRole, getRolePath
-
Methods inherited from interface org.hibernate.metamodel.mapping.Restrictable
applyBaseRestrictions
-
Methods inherited from interface org.hibernate.sql.ast.tree.from.TableGroupProducer
containsTableReference
-
-
-
-
Field Detail
-
ENTITY_ID
@Deprecated(since="6.2") static final String ENTITY_ID
Deprecated.this feature of HQL is now deprecatedThe property name of the "special" identifier property in HQL- See Also:
- Constant Field Values
-
-
Method Detail
-
postInstantiate
void postInstantiate() throws MappingException
Finish the initialization of this object.The method
InFlightEntityMappingType.prepareMappingModel(org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess)
must have been called for every entity persister before this method is invoked.Called only once per
SessionFactory
lifecycle, after all entity persisters have been instantiated.- Throws:
MappingException
- Indicates an issue in the metadata.
-
prepareLoaders
default void prepareLoaders()
Prepare loaders associated with the persister. Distinct "phase" in building the persister after InFlightEntityMappingType.prepareMappingModel(org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess) and postInstantiate() have occurred. The distinct phase is used to ensure that all TableDetails are available across the entire model
-
getFactory
SessionFactoryImplementor getFactory()
Return theSessionFactory
to which this persister belongs.- Returns:
- The owning
SessionFactory
.
-
getSqlAliasStem
default String getSqlAliasStem()
Description copied from interface:TableGroupProducer
Get the "stem" used as the base for generating SQL table aliases for table references that are part of the TableGroup being generatedNote that this is a metadata-ive value. It is only ever used internal to the producer producing its TableGroup.
- Specified by:
getSqlAliasStem
in interfaceEntityMappingType
- Specified by:
getSqlAliasStem
in interfaceTableGroupProducer
- See Also:
SqlAliasBaseManager.createSqlAliasBase(java.lang.String)
-
getEntityEntryFactory
EntityEntryFactory getEntityEntryFactory()
Get the EntityEntryFactory indicated for the entity mapped by this persister.- Returns:
- The proper EntityEntryFactory.
-
getRootEntityName
String getRootEntityName()
Returns an object that identifies the space in which identifiers of this entity hierarchy are unique. Might be a table name, a JNDI URL, etc.- Returns:
- The root entity name.
-
getEntityName
String getEntityName()
The entity name which this persister maps.- Specified by:
getEntityName
in interfaceEntityMappingType
- Returns:
- The name of the entity which this persister maps.
-
getSqmMultiTableMutationStrategy
SqmMultiTableMutationStrategy getSqmMultiTableMutationStrategy()
The strategy to use for SQM mutation statements where the target entity has multiple tables. Returnsnull
to indicate that the entity does not have multiple tables.- Specified by:
getSqmMultiTableMutationStrategy
in interfaceEntityMappingType
-
getSqmMultiTableInsertStrategy
SqmMultiTableInsertStrategy getSqmMultiTableInsertStrategy()
- Specified by:
getSqmMultiTableInsertStrategy
in interfaceEntityMappingType
-
getEntityMetamodel
EntityMetamodel getEntityMetamodel()
Retrieve the underlying entity metamodel instance.- Returns:
- The metamodel
-
initializeEnhancedEntityUsedAsProxy
default Object initializeEnhancedEntityUsedAsProxy(Object entity, String nameOfAttributeBeingAccessed, SharedSessionContractImplementor session)
Called fromEnhancementAsProxyLazinessInterceptor
to trigger load of the entity's non-lazy state as well as the named attribute we are accessing if it is still uninitialized after fetching non-lazy state.
-
isSubclassEntityName
boolean isSubclassEntityName(String entityName)
Determine whether the given name represents a subclass entity (or this entity itself) of the entity mapped by this persister.- Parameters:
entityName
- The entity name to be checked.- Returns:
- True if the given entity name represents either the entity mapped by this persister or one of its subclass entities; false otherwise.
-
getPropertySpaces
String[] getPropertySpaces()
Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class only.For most implementations, this returns the complete set of table names to which instances of the mapped entity are persisted (not accounting for superclass entity mappings).
- Returns:
- The property spaces.
-
getQuerySpaces
Serializable[] getQuerySpaces()
Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class and its subclasses.Much like
getPropertySpaces()
, except that here we include subclass entity spaces.- Returns:
- The query spaces.
-
getSynchronizationSpaces
default String[] getSynchronizationSpaces()
The table names this entity needs to be synchronized against.Much like
getPropertySpaces()
, except that here we include subclass entity spaces.- Returns:
- The synchronization spaces.
-
getSynchronizedQuerySpaces
default String[] getSynchronizedQuerySpaces()
Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class and its subclasses.Much like
getPropertySpaces()
, except that here we include subclass entity spaces.- Returns:
- The query spaces.
-
visitQuerySpaces
default void visitQuerySpaces(Consumer<String> querySpaceConsumer)
Description copied from interface:EntityMappingType
Visit each "query space" for the mapped entity.- Specified by:
visitQuerySpaces
in interfaceEntityMappingType
-
hasProxy
boolean hasProxy()
Determine whether this entity supports dynamic proxies.- Returns:
- True if the entity has dynamic proxy support; false otherwise.
-
hasCollections
boolean hasCollections()
Determine whether this entity contains references to persistent collections.- Returns:
- True if the entity does contain persistent collections; false otherwise.
-
hasMutableProperties
boolean hasMutableProperties()
Determine whether any properties of this entity are considered mutable.- Returns:
- True if any properties of the entity are mutable; false otherwise (meaning none are).
-
hasSubselectLoadableCollections
boolean hasSubselectLoadableCollections()
Determine whether this entity contains references to persistent collections which are fetchable by subselect?- Returns:
- True if the entity contains collections fetchable by subselect; false otherwise.
-
hasCollectionNotReferencingPK
boolean hasCollectionNotReferencingPK()
Determine whether this entity contains references to persistent collections not referencing the primary key.- Returns:
- True if the entity contains a collection not referencing the primary key; false otherwise.
- Since:
- 6.2
-
hasCascades
boolean hasCascades()
Determine whether this entity has any (non-none) cascading.- Returns:
- True if the entity has any properties with a cascade other than NONE; false otherwise (aka, no cascading).
-
hasCascadeDelete
default boolean hasCascadeDelete()
Determine whether this entity has any delete cascading.- Returns:
- True if the entity has any properties with a cascade other than NONE; false otherwise.
-
hasOwnedCollections
default boolean hasOwnedCollections()
Determine whether this entity has any owned collections.- Returns:
- True if the entity has an owned collection; false otherwise.
-
isMutable
boolean isMutable()
Determine whether instances of this entity are considered mutable.- Returns:
- True if the entity is considered mutable; false otherwise.
-
isInherited
boolean isInherited()
Determine whether the entity is inherited one or more other entities. In other words, is this entity a subclass of other entities.- Returns:
- True if other entities extend this entity; false otherwise.
-
isIdentifierAssignedByInsert
boolean isIdentifierAssignedByInsert()
Are identifiers of this entity assigned known before the insert execution? Or, are they generated (in the database) by the insert execution.- Returns:
- True if identifiers for this entity are generated by the insert execution.
-
getPropertyType
@Deprecated(since="6", forRemoval=true) Type getPropertyType(String propertyName) throws MappingException
Deprecated, for removal: This API element is subject to removal in a future version.Get the type of a particular property by name.- Parameters:
propertyName
- The name of the property for which to retrieve the type.- Returns:
- The type.
- Throws:
MappingException
- Typically indicates an unknown property name.
-
findDirty
int[] findDirty(Object[] currentState, Object[] previousState, Object owner, SharedSessionContractImplementor session)
Compare the two snapshots to determine if they represent dirty state.- Parameters:
currentState
- The current snapshotpreviousState
- The baseline snapshotowner
- The entity containing the statesession
- The originating session- Returns:
- The indices of all dirty properties, or null if no properties were dirty.
-
findModified
int[] findModified(Object[] old, Object[] current, Object object, SharedSessionContractImplementor session)
Compare the two snapshots to determine if they represent modified state.- Parameters:
old
- The baseline snapshotcurrent
- The current snapshotobject
- The entity containing the statesession
- The originating session- Returns:
- The indices of all modified properties, or null if no properties were modified.
-
hasIdentifierProperty
boolean hasIdentifierProperty()
Determine whether the entity has a particular property holding the identifier value.- Returns:
- True if the entity has a specific property holding identifier value.
-
canExtractIdOutOfEntity
@Deprecated(since="6") default boolean canExtractIdOutOfEntity()
Deprecated.This feature is no longer supportedDetermine whether detached instances of this entity carry their own identifier value.The other option is the deprecated feature where users could supply the id during session calls.
- Returns:
- True if either (1)
hasIdentifierProperty()
or (2) the identifier is an embedded composite identifier; false otherwise.
-
isVersioned
boolean isVersioned()
Determine whether optimistic locking by column is enabled for this entity.- Returns:
- True if optimistic locking by column (i.e.,
<version/>
or<timestamp/>
) is enabled; false otherwise.
-
getVersionType
BasicType<?> getVersionType()
IfisVersioned()
, then what is the type of the property holding the locking value.- Returns:
- The type of the version property; or null, if not versioned.
-
getVersionJavaType
default VersionJavaType<Object> getVersionJavaType()
-
getVersionProperty
int getVersionProperty()
IfisVersioned()
, then what is the index of the property holding the locking value.- Returns:
- The type of the version property; or -66, if not versioned.
-
hasNaturalIdentifier
boolean hasNaturalIdentifier()
Determine whether this entity defines a natural identifier.- Returns:
- True if the entity defines a natural id; false otherwise.
-
getNaturalIdentifierProperties
int[] getNaturalIdentifierProperties()
If the entity defines a natural id, that is, ifhasNaturalIdentifier()
returnstrue
, the indices of the properties which make up the natural id.- Returns:
- The indices of the properties making up the natural id; or null, if no natural id is defined.
-
getNaturalIdentifierSnapshot
Object getNaturalIdentifierSnapshot(Object id, SharedSessionContractImplementor session)
Retrieve the current state of the natural-id properties from the database.- Parameters:
id
- The identifier of the entity for which to retrieve the natural-id values.session
- The session from which the request originated.- Returns:
- The natural-id snapshot.
-
getIdentifierGenerator
@Deprecated IdentifierGenerator getIdentifierGenerator()
Deprecated.usegetGenerator()
Determine which identifier generation strategy is used for this entity.- Returns:
- The identifier generation strategy.
-
getGenerator
default Generator getGenerator()
-
getVersionGenerator
default BeforeExecutionGenerator getVersionGenerator()
-
getAttributeMapping
default AttributeMapping getAttributeMapping(int position)
Description copied from interface:EntityMappingType
Retrieve an attribute mapping by position, relative to all attributes- Specified by:
getAttributeMapping
in interfaceEntityMappingType
- Specified by:
getAttributeMapping
in interfaceManagedMappingType
-
breakDownJdbcValues
default <X,Y> int breakDownJdbcValues(Object domainValue, int offset, X x, Y y, ModelPart.JdbcValueBiConsumer<X,Y> valueConsumer, SharedSessionContractImplementor session)
Description copied from interface:ModelPart
Breaks down the domain value to its constituent JDBC values. Think of it as breaking the multi-dimensional array into a visitable flat array. Additionally, it passes through the valuesX
andY
to the consumer. Returns the amount of jdbc types that have been visited.- Specified by:
breakDownJdbcValues
in interfaceModelPart
-
hasLazyProperties
boolean hasLazyProperties()
Determine whether this entity defines any lazy properties (when bytecode instrumentation is enabled).- Returns:
- True if the entity has properties mapped as lazy; false otherwise.
-
getNaturalIdLoader
default NaturalIdLoader<?> getNaturalIdLoader()
Description copied from interface:EntityMappingType
Access to performing natural-id database selection. This is per-entity in the hierarchy- Specified by:
getNaturalIdLoader
in interfaceEntityMappingType
-
getMultiNaturalIdLoader
default MultiNaturalIdLoader<?> getMultiNaturalIdLoader()
Description copied from interface:EntityMappingType
Access to performing multi-value natural-id database selection. This is per-entity in the hierarchy- Specified by:
getMultiNaturalIdLoader
in interfaceEntityMappingType
-
loadEntityIdByNaturalId
Object loadEntityIdByNaturalId(Object[] naturalIdValues, LockOptions lockOptions, SharedSessionContractImplementor session)
Load the id for the entity based on the natural id.
-
load
Object load(Object id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session)
Load an instance of the persistent class.
-
load
@Deprecated(since="6.0") default Object load(Object id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session, Boolean readOnly) throws HibernateException
Deprecated.- Throws:
HibernateException
-
load
Object load(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session)
Load an instance of the persistent class.
-
load
default Object load(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session, Boolean readOnly) throws HibernateException
- Throws:
HibernateException
-
multiLoad
List<?> multiLoad(Object[] ids, EventSource session, MultiIdLoadOptions loadOptions)
Performs a load of multiple entities (of this type) by identifier simultaneously.- Parameters:
ids
- The identifiers to loadsession
- The originating SessionloadOptions
- The options for loading- Returns:
- The loaded, matching entities
-
loadByUniqueKey
default Object loadByUniqueKey(String propertyName, Object uniqueKey, SharedSessionContractImplementor session)
Description copied from interface:EntityMappingType
Load an instance of the persistent class, by a unique key other than the primary key.- Specified by:
loadByUniqueKey
in interfaceEntityMappingType
-
lock
void lock(Object id, Object version, Object object, LockMode lockMode, EventSource session)
Do a version check (optional operation)
-
lock
void lock(Object id, Object version, Object object, LockOptions lockOptions, EventSource session)
Do a version check (optional operation)
-
insert
@Deprecated(forRemoval=true, since="6.5") default void insert(Object id, Object[] fields, Object object, SharedSessionContractImplementor session)
Deprecated, for removal: This API element is subject to removal in a future version.Persist an instance- See Also:
getInsertCoordinator()
-
insert
@Deprecated(forRemoval=true, since="6.5") default Object insert(Object[] fields, Object object, SharedSessionContractImplementor session)
Deprecated, for removal: This API element is subject to removal in a future version.Persist an instance- See Also:
getInsertCoordinator()
-
delete
@Deprecated(forRemoval=true, since="6.5") default void delete(Object id, Object version, Object object, SharedSessionContractImplementor session)
Deprecated, for removal: This API element is subject to removal in a future version.Delete a persistent instance- See Also:
getDeleteCoordinator()
-
update
@Deprecated(forRemoval=true, since="6.5") default void update(Object id, Object[] fields, int[] dirtyFields, boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object object, Object rowId, SharedSessionContractImplementor session)
Deprecated, for removal: This API element is subject to removal in a future version.Update a persistent instance- See Also:
getUpdateCoordinator()
-
merge
@Deprecated(forRemoval=true, since="6.5") default void merge(Object id, Object[] fields, int[] dirtyFields, boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object object, Object rowId, SharedSessionContractImplementor session)
Deprecated, for removal: This API element is subject to removal in a future version.Merge a persistent instance- See Also:
getMergeCoordinator()
-
getInsertCoordinator
InsertCoordinator getInsertCoordinator()
Get the insert coordinator instance.- Since:
- 6.5
-
getUpdateCoordinator
UpdateCoordinator getUpdateCoordinator()
Get the update coordinator instance.- Since:
- 6.5
-
getDeleteCoordinator
DeleteCoordinator getDeleteCoordinator()
Get the delete coordinator instance.- Since:
- 6.5
-
getMergeCoordinator
default UpdateCoordinator getMergeCoordinator()
Get the merge coordinator instance.- Since:
- 6.5
-
getPropertyTypes
Type[] getPropertyTypes()
Get the Hibernate types of the class properties
-
getPropertyNames
String[] getPropertyNames()
Get the names of the class properties - doesn't have to be the names of the actual Java properties (used for XML generation only)
-
getPropertyInsertability
boolean[] getPropertyInsertability()
Get the "insertability" of the properties of this class (does the property appear in an SQL INSERT)
-
getPropertyUpdateability
boolean[] getPropertyUpdateability()
Get the "updateability" of the properties of this class (does the property appear in an SQL UPDATE)
-
getPropertyCheckability
boolean[] getPropertyCheckability()
Get the "checkability" of the properties of this class (is the property dirty checked, does the cache need to be updated)
-
getPropertyNullability
boolean[] getPropertyNullability()
Get the nullability of the properties of this class
-
getPropertyVersionability
boolean[] getPropertyVersionability()
Get the "versionability" of the properties of this class (is the property optimistic-locked)
-
getPropertyLaziness
boolean[] getPropertyLaziness()
-
getPropertyCascadeStyles
CascadeStyle[] getPropertyCascadeStyles()
Get the cascade styles of the properties (optional operation)
-
isPropertySelectable
default boolean isPropertySelectable(int propertyNumber)
-
getIdentifierType
Type getIdentifierType()
Get the identifier type
-
getIdentifierPropertyName
String getIdentifierPropertyName()
Get the name of the identifier property (or return null) - need not return the name of an actual Java property
-
isCacheInvalidationRequired
boolean isCacheInvalidationRequired()
Should we always invalidate the cache instead of recaching updated state
-
isLazyPropertiesCacheable
boolean isLazyPropertiesCacheable()
Should lazy properties of this entity be cached?
-
canReadFromCache
boolean canReadFromCache()
-
canWriteToCache
boolean canWriteToCache()
-
hasCache
@Deprecated boolean hasCache()
Deprecated.UsecanReadFromCache()
and/orcanWriteToCache()
depending on needDoes this class have a cache.
-
getCacheAccessStrategy
EntityDataAccess getCacheAccessStrategy()
Get the cache (optional operation)
-
getCacheEntryStructure
CacheEntryStructure getCacheEntryStructure()
Get the cache structure
-
buildCacheEntry
CacheEntry buildCacheEntry(Object entity, Object[] state, Object version, SharedSessionContractImplementor session)
-
hasNaturalIdCache
boolean hasNaturalIdCache()
Does this class have a natural id cache
-
getNaturalIdCacheAccessStrategy
NaturalIdDataAccess getNaturalIdCacheAccessStrategy()
Get the NaturalId cache (optional operation)
-
getClassMetadata
@Deprecated(since="6.0") ClassMetadata getClassMetadata()
Deprecated.This operation is no longer called by Hibernate.Get the user-visible metadata for the class (optional operation)
-
getBatchSize
default int getBatchSize()
The batch size for batch loading.- Specified by:
getBatchSize
in interfaceLoadable
- See Also:
LoadQueryInfluencers.effectiveBatchSize(EntityPersister)
-
isBatchLoadable
default boolean isBatchLoadable()
Is batch loading enabled?
-
isSelectBeforeUpdateRequired
boolean isSelectBeforeUpdateRequired()
Is select snapshot before update enabled?
-
getDatabaseSnapshot
Object[] getDatabaseSnapshot(Object id, SharedSessionContractImplementor session) throws HibernateException
Get the current database state of the object, in a "hydrated" form, without resolving identifiers.- Returns:
- null if there is no row in the database
- Throws:
HibernateException
-
getIdByUniqueKey
Object getIdByUniqueKey(Object key, String uniquePropertyName, SharedSessionContractImplementor session)
-
getCurrentVersion
Object getCurrentVersion(Object id, SharedSessionContractImplementor session) throws HibernateException
Get the current version of the object, or return null if there is no row for the given identifier. In the case of unversioned data, return any object if the row exists.- Throws:
HibernateException
-
forceVersionIncrement
Object forceVersionIncrement(Object id, Object currentVersion, SharedSessionContractImplementor session) throws HibernateException
- Throws:
HibernateException
-
forceVersionIncrement
default Object forceVersionIncrement(Object id, Object currentVersion, boolean batching, SharedSessionContractImplementor session) throws HibernateException
- Throws:
HibernateException
-
isInstrumented
boolean isInstrumented()
Has the class actually been bytecode instrumented?
-
hasInsertGeneratedProperties
boolean hasInsertGeneratedProperties()
Does this entity define any properties as being database generated on insert?- Returns:
- True if this entity contains at least one property defined as generated (including version property, but not identifier).
-
hasUpdateGeneratedProperties
boolean hasUpdateGeneratedProperties()
Does this entity define any properties as being database generated on update?- Returns:
- True if this entity contains at least one property defined as generated (including version property, but not identifier).
-
isVersionPropertyGenerated
boolean isVersionPropertyGenerated()
Does this entity contain a version property that is defined to be database generated?- Returns:
- true if this entity contains a version property and that property has been marked as generated.
-
afterInitialize
void afterInitialize(Object entity, SharedSessionContractImplementor session)
Called just after the entities properties have been initialized
-
afterReassociate
void afterReassociate(Object entity, SharedSessionContractImplementor session)
Called just after the entity has been reassociated with the session
-
createProxy
Object createProxy(Object id, SharedSessionContractImplementor session)
Create a new proxy instance
-
isTransient
Boolean isTransient(Object object, SharedSessionContractImplementor session)
Is this a new transient instance?
-
getPropertyValuesToInsert
Object[] getPropertyValuesToInsert(Object object, Map<Object,Object> mergeMap, SharedSessionContractImplementor session)
Return the values of the insertable properties of the object (including backrefs)
-
processInsertGeneratedProperties
@Deprecated(forRemoval=true, since="6.5") default void processInsertGeneratedProperties(Object id, Object entity, Object[] state, SharedSessionContractImplementor session)
Deprecated, for removal: This API element is subject to removal in a future version.Perform a select to retrieve the values of any generated properties back from the database, injecting these generated values into the given entity as well as writing this state to thePersistenceContext
.Note, that because we update the PersistenceContext here, callers need to take care that they have already written the initial snapshot to the PersistenceContext before calling this method.
-
processInsertGeneratedProperties
default void processInsertGeneratedProperties(Object id, Object entity, Object[] state, GeneratedValues generatedValues, SharedSessionContractImplementor session)
Retrieve the values of any insert generated properties through the providedGeneratedValues
or, when that's not available, by selecting them back from the database, injecting these generated values into the given entity as well as writing this state to thePersistenceContext
.Note, that because we update the PersistenceContext here, callers need to take care that they have already written the initial snapshot to the PersistenceContext before calling this method.
-
processUpdateGeneratedProperties
@Deprecated(forRemoval=true, since="6.5") default void processUpdateGeneratedProperties(Object id, Object entity, Object[] state, SharedSessionContractImplementor session)
Deprecated, for removal: This API element is subject to removal in a future version.Perform a select to retrieve the values of any generated properties back from the database, injecting these generated values into the given entity as well as writing this state to thePersistenceContext
.Note, that because we update the PersistenceContext here, callers need to take care that they have already written the initial snapshot to the PersistenceContext before calling this method.
-
processUpdateGeneratedProperties
void processUpdateGeneratedProperties(Object id, Object entity, Object[] state, GeneratedValues generatedValues, SharedSessionContractImplementor session)
Retrieve the values of any update generated properties through the providedGeneratedValues
or, when that's not available, by selecting them back from the database, injecting these generated values into the given entity as well as writing this state to thePersistenceContext
.Note, that because we update the PersistenceContext here, callers need to take care that they have already written the initial snapshot to the PersistenceContext before calling this method.
-
getMappedClass
Class<?> getMappedClass()
The persistent class, or null
-
implementsLifecycle
boolean implementsLifecycle()
Does the class implement theLifecycle
interface?
-
getConcreteProxyClass
Class<?> getConcreteProxyClass()
Get the proxy interface that instances of this concrete class will be cast to (optional operation).
-
setValues
default void setValues(Object object, Object[] values)
Description copied from interface:ManagedMappingType
Inject the attribute values into the entity instance- Specified by:
setValues
in interfaceManagedMappingType
-
setPropertyValues
@Deprecated(since="6.0") void setPropertyValues(Object object, Object[] values)
Deprecated.UsesetValues(java.lang.Object, java.lang.Object[])
insteadSet the given values to the mapped properties of the given object.
-
setValue
default void setValue(Object object, int i, Object value)
Description copied from interface:ManagedMappingType
Inject a specific attribute value into the entity instance, by position- Specified by:
setValue
in interfaceManagedMappingType
-
setPropertyValue
@Deprecated(since="6.0") void setPropertyValue(Object object, int i, Object value)
Deprecated.Set the value of a particular property of the given instance.
-
getValues
default Object[] getValues(Object object)
Description copied from interface:ManagedMappingType
Extract the individual attribute values from the entity instance- Specified by:
getValues
in interfaceManagedMappingType
-
getPropertyValues
@Deprecated(since="6.0") Object[] getPropertyValues(Object object)
Deprecated.UsegetValues(java.lang.Object)
instead
-
getValue
default Object getValue(Object object, int i)
Description copied from interface:ManagedMappingType
Extract a specific attribute value from the entity instance, by position- Specified by:
getValue
in interfaceManagedMappingType
-
getPropertyValue
@Deprecated(since="6.0") Object getPropertyValue(Object object, int i) throws HibernateException
Deprecated.UsegetValue(java.lang.Object, int)
instead- Throws:
HibernateException
-
getPropertyValue
Object getPropertyValue(Object object, String propertyName)
Get the value of a particular property
-
getIdentifier
Object getIdentifier(Object entity, SharedSessionContractImplementor session)
Get the identifier of an instance from the object's identifier property. Throw an exception if it has no identifier property.
-
getIdentifier
default Object getIdentifier(Object entity, MergeContext mergeContext)
Get the identifier of an instance from the object's identifier property. Throw an exception if it has no identifier property. It's supposed to be use during the merging process
-
setIdentifier
void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session)
Inject the identifier value into the given entity.
-
getVersion
Object getVersion(Object object) throws HibernateException
Get the version number (or timestamp) from the object's version property. Returnnull
if it is not versioned.- Throws:
HibernateException
-
instantiate
Object instantiate(Object id, SharedSessionContractImplementor session)
Create a class instance initialized with the given identifier- Parameters:
id
- The identifier value to use (may be null to represent no value)session
- The session from which the request originated.- Returns:
- The instantiated entity.
-
isInstance
boolean isInstance(Object object)
Is the given object an instance of this entity?
-
hasUninitializedLazyProperties
boolean hasUninitializedLazyProperties(Object object)
Does the given instance have any uninitialized lazy properties?
-
resetIdentifier
void resetIdentifier(Object entity, Object currentId, Object currentVersion, SharedSessionContractImplementor session)
Set the identifier and version of the given instance back to its "unsaved" value, that is, the value it had before it was made persistent.
-
getSubclassEntityPersister
EntityPersister getSubclassEntityPersister(Object instance, SessionFactoryImplementor factory)
Obtain theEntityPersister
for the concrete class of the given entity instance which participates in a mapped inheritance hierarchy with this persister. The given instance must be an instance of a subclass of the persistent class managed by this persister.A request has already identified the entity name of this persister as the mapping for the given instance. However, we still need to account for possible subclassing and potentially reroute to the more appropriate persister.
For example, a request names
Animal
as the entity name which gets resolved to this persister. But the actual instance is really an instance ofCat
which is a subclass ofAnimal
. So, here theAnimal
persister is being asked to return the persister specific toCat
.It's also possible that the instance is actually an
Animal
instance in the above example in which case we would returnthis
from this method.- Parameters:
instance
- The entity instancefactory
- Reference to the SessionFactory- Returns:
- The appropriate persister
- Throws:
HibernateException
- Indicates that instance was deemed to not be a subclass of the entity mapped by this persister.
-
getRepresentationStrategy
EntityRepresentationStrategy getRepresentationStrategy()
Description copied from interface:EntityMappingType
Describes how the entity is represented in the application's domain model.- Specified by:
getRepresentationStrategy
in interfaceEntityMappingType
-
getEntityMappingType
default EntityMappingType getEntityMappingType()
Description copied from interface:EntityValuedModelPart
The descriptor of the entity that is the type for this part- Specified by:
getEntityMappingType
in interfaceEntityValuedModelPart
-
addToCacheKey
default void addToCacheKey(MutableCacheKeyBuilder cacheKey, Object value, SharedSessionContractImplementor session)
Description copied from interface:Bindable
Add to the MutableCacheKey the values obtained disassembling the value and the hasCode generated from the disassembled value.- Specified by:
addToCacheKey
in interfaceBindable
- Specified by:
addToCacheKey
in interfaceEntityValuedModelPart
- Parameters:
cacheKey
- the MutableCacheKey used to add the disassembled value and the hashCodevalue
- the value to disassemblesession
- the SharedSessionContractImplementor
-
getInstrumentationMetadata
BytecodeEnhancementMetadata getInstrumentationMetadata()
-
getBytecodeEnhancementMetadata
default BytecodeEnhancementMetadata getBytecodeEnhancementMetadata()
-
getFilterAliasGenerator
FilterAliasGenerator getFilterAliasGenerator(String rootAlias)
-
getFilterAliasGenerator
default FilterAliasGenerator getFilterAliasGenerator(TableGroup rootTableGroup)
-
resolveAttributeIndexes
int[] resolveAttributeIndexes(String[] attributeNames)
Converts an array of attribute names to a set of indexes, according to the entity metamodel- Parameters:
attributeNames
- Array of names to be resolved- Returns:
- A set of unique indexes of the attribute names found in the metamodel
-
resolveDirtyAttributeIndexes
default int[] resolveDirtyAttributeIndexes(Object[] values, Object[] loadedState, String[] attributeNames, SessionImplementor session)
LikeresolveAttributeIndexes(String[])
but also always returns mutable attributes- Parameters:
attributeNames
- Array of names to be resolved- Returns:
- A set of unique indexes of the attribute names found in the metamodel
-
canUseReferenceCacheEntries
boolean canUseReferenceCacheEntries()
-
useShallowQueryCacheLayout
@Incubating boolean useShallowQueryCacheLayout()
-
storeDiscriminatorInShallowQueryCacheLayout
@Incubating boolean storeDiscriminatorInShallowQueryCacheLayout()
-
hasFilterForLoadByKey
boolean hasFilterForLoadByKey()
-
uniqueKeyEntries
@Incubating Iterable<UniqueKeyEntry> uniqueKeyEntries()
- Returns:
- Metadata for each unique key defined
-
getSelectByUniqueKeyString
String getSelectByUniqueKeyString(String propertyName)
Get a SQL select string that performs a select based on a unique key determined by the given property name.- Parameters:
propertyName
- The name of the property which maps to the column(s) to use in the select statement restriction.- Returns:
- The SQL select string
-
getSelectByUniqueKeyString
default String getSelectByUniqueKeyString(String[] propertyNames)
Get a SQL select string that performs a select based on a unique key determined by the given property names.- Parameters:
propertyNames
- The names of the properties which maps to the column(s) to use in the select statement restriction.- Returns:
- The SQL select string
-
getSelectByUniqueKeyString
String getSelectByUniqueKeyString(String[] propertyNames, String[] columnNames)
-
getRootTableKeyColumnNames
String[] getRootTableKeyColumnNames()
The names of the primary key columns in the root table.- Returns:
- The primary key column names.
-
getIdentitySelectString
String getIdentitySelectString()
Get the database-specific SQL command to retrieve the last generated IDENTITY value.- Returns:
- The SQL command string
-
getIdentifierColumnNames
String[] getIdentifierColumnNames()
-
-