Package org.hibernate.persister.entity
Interface EntityPersister
-
- All Superinterfaces:
AttributeSource,EntityDefinition
- All Known Subinterfaces:
Loadable,Lockable,OuterJoinLoadable,PostInsertIdentityPersister,Queryable,SQLLoadable,UniqueKeyLoadable
- All Known Implementing Classes:
AbstractEntityPersister,JoinedSubclassEntityPersister,SingleTableEntityPersister,UnionSubclassEntityPersister
public interface EntityPersister extends EntityDefinition
Contract describing mapping information and persistence logic for a particular strategy of entity mapping. A given persister instance corresponds to a given mapped entity class. Implementations must be thread-safe (preferably immutable). Unless a customPersisterFactoryis used, it is expected that implementations of EntityPersister 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 the natural-id defined for this entity, if one -
PersisterCreationContext- access to additional information useful while constructing the persister.
- See Also:
PersisterFactory,PersisterClassResolver
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringENTITY_IDThe property name of the "special" identifier property in HQL
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description voidafterInitialize(java.lang.Object entity, SharedSessionContractImplementor session)Called just after the entities properties have been initializedvoidafterReassociate(java.lang.Object entity, SharedSessionContractImplementor session)Called just after the entity has been reassociated with the sessionCacheEntrybuildCacheEntry(java.lang.Object entity, java.lang.Object[] state, java.lang.Object version, SharedSessionContractImplementor session)booleancanExtractIdOutOfEntity()Determine whether detached instances of this entity carry their own identifier value.default booleancanIdentityInsertBeDelayed()Deprecated.Since 5.4.1, this is no longer used.booleancanReadFromCache()booleancanUseReferenceCacheEntries()booleancanWriteToCache()java.lang.ObjectcreateProxy(java.io.Serializable id, SharedSessionContractImplementor session)Create a new proxy instancevoiddelete(java.io.Serializable id, java.lang.Object version, java.lang.Object object, SharedSessionContractImplementor session)Delete a persistent instanceint[]findDirty(java.lang.Object[] currentState, java.lang.Object[] previousState, java.lang.Object owner, SharedSessionContractImplementor session)Compare the two snapshots to determine if they represent dirty state.int[]findModified(java.lang.Object[] old, java.lang.Object[] current, java.lang.Object object, SharedSessionContractImplementor session)Compare the two snapshots to determine if they represent modified state.java.lang.ObjectforceVersionIncrement(java.io.Serializable id, java.lang.Object currentVersion, SharedSessionContractImplementor session)voidgenerateEntityDefinition()Generate the entity definition for this object.default BytecodeEnhancementMetadatagetBytecodeEnhancementMetadata()EntityDataAccessgetCacheAccessStrategy()Get the cache (optional operation)CacheEntryStructuregetCacheEntryStructure()Get the cache structureClassMetadatagetClassMetadata()Get the user-visible metadata for the class (optional operation)java.lang.ClassgetConcreteProxyClass()Get the proxy interface that instances of this concrete class will be cast to (optional operation).java.lang.ObjectgetCurrentVersion(java.io.Serializable id, SharedSessionContractImplementor session)Get the current version of the object, or return null if there is no row for the given identifier.java.lang.Object[]getDatabaseSnapshot(java.io.Serializable id, SharedSessionContractImplementor session)Get the current database state of the object, in a "hydrated" form, without resolving identifiersEntityEntryFactorygetEntityEntryFactory()Get the EntityEntryFactory indicated for the entity mapped by this persister.EntityMetamodelgetEntityMetamodel()Retrieve the underlying entity metamodel instance...EntityModegetEntityMode()java.lang.StringgetEntityName()The entity name which this persister maps.EntityTuplizergetEntityTuplizer()SessionFactoryImplementorgetFactory()Return the SessionFactory to which this persister "belongs".org.hibernate.internal.FilterAliasGeneratorgetFilterAliasGenerator(java.lang.String rootAlias)java.io.SerializablegetIdByUniqueKey(java.io.Serializable key, java.lang.String uniquePropertyName, SharedSessionContractImplementor session)java.io.SerializablegetIdentifier(java.lang.Object object)Deprecated.java.io.SerializablegetIdentifier(java.lang.Object entity, SharedSessionContractImplementor session)Get the identifier of an instance (throw an exception if no identifier property)IdentifierGeneratorgetIdentifierGenerator()Determine which identifier generation strategy is used for this entity.java.lang.StringgetIdentifierPropertyName()Get the name of the identifier property (or return null) - need not return the name of an actual Java propertyTypegetIdentifierType()Get the identifier typeBytecodeEnhancementMetadatagetInstrumentationMetadata()java.lang.ClassgetMappedClass()The persistent class, or nullNaturalIdDataAccessgetNaturalIdCacheAccessStrategy()Get the NaturalId cache (optional operation)int[]getNaturalIdentifierProperties()If the entity defines a natural id (hasNaturalIdentifier()), which properties make up the natural id.java.lang.Object[]getNaturalIdentifierSnapshot(java.io.Serializable id, SharedSessionContractImplementor session)Retrieve the current state of the natural-id properties from the database.NavigableRolegetNavigableRole()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)ValueInclusion[]getPropertyInsertGenerationInclusions()Deprecated.Replaced internally with InMemoryValueGenerationStrategy / InDatabaseValueGenerationStrategyboolean[]getPropertyLaziness()java.lang.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 classjava.io.Serializable[]getPropertySpaces()Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class only.TypegetPropertyType(java.lang.String propertyName)Get the type of a particular property by name.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)ValueInclusion[]getPropertyUpdateGenerationInclusions()Deprecated.Replaced internally with InMemoryValueGenerationStrategy / InDatabaseValueGenerationStrategyjava.lang.ObjectgetPropertyValue(java.lang.Object object, int i)Get the value of a particular propertyjava.lang.ObjectgetPropertyValue(java.lang.Object object, java.lang.String propertyName)Get the value of a particular propertyjava.lang.Object[]getPropertyValues(java.lang.Object object)Return the (loaded) values of the mapped properties of the object (not including backrefs)java.lang.Object[]getPropertyValuesToInsert(java.lang.Object object, java.util.Map 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)java.io.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.java.lang.StringgetRootEntityName()Returns an object that identifies the space in which identifiers of this entity hierarchy are unique.EntityPersistergetSubclassEntityPersister(java.lang.Object instance, SessionFactoryImplementor factory)A request has already identified the entity-name of this persister as the mapping for the given instance.java.lang.ObjectgetVersion(java.lang.Object object)Get the version number (or timestamp) from the object's version property (or return null if not versioned)intgetVersionProperty()IfisVersioned(), then what is the index of the property holding the locking value.VersionTypegetVersionType()IfisVersioned(), then what is the type of the property holding the locking value.booleanhasCache()Deprecated.UsecanReadFromCache()and/orcanWriteToCache()depending on needbooleanhasCascades()Determine whether this entity has any non-none cascading.booleanhasCollections()Determine whether this entity contains references to persistent collections.booleanhasIdentifierProperty()Determine whether the entity has a particular property holding the identifier value.booleanhasInsertGeneratedProperties()Does this entity define any properties as being database generated on insert?booleanhasLazyProperties()Determine whether this entity defines any lazy properties (ala bytecode instrumentation).booleanhasMutableProperties()Determine whether any properties of this entity are considered mutable.booleanhasNaturalIdCache()Does this class have a natural id cachebooleanhasNaturalIdentifier()Determine whether this entity defines a natural identifier.booleanhasProxy()Determine whether this entity supports dynamic proxies.booleanhasSubselectLoadableCollections()Determine whether this entity contains references to persistent collections which are fetchable by subselect?booleanhasUninitializedLazyProperties(java.lang.Object object)Does the given instance have any uninitialized lazy properties?booleanhasUpdateGeneratedProperties()Does this entity define any properties as being database generated on update?booleanimplementsLifecycle()Does the class implement theLifecycleinterface.default java.lang.ObjectinitializeEnhancedEntityUsedAsProxy(java.lang.Object entity, java.lang.String nameOfAttributeBeingAccessed, SharedSessionContractImplementor session)Called fromEnhancementAsProxyLazinessInterceptorto 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 statevoidinsert(java.io.Serializable id, java.lang.Object[] fields, java.lang.Object object, SharedSessionContractImplementor session)Persist an instancejava.io.Serializableinsert(java.lang.Object[] fields, java.lang.Object object, SharedSessionContractImplementor session)Persist an instance, using a natively generated identifier (optional operation)java.lang.Objectinstantiate(java.io.Serializable id, SharedSessionContractImplementor session)Create a class instance initialized with the given identifierbooleanisBatchLoadable()Is batch loading enabled?booleanisCacheInvalidationRequired()Should we always invalidate the cache instead of recaching updated statebooleanisIdentifierAssignedByInsert()Are identifiers of this entity assigned known before the insert execution? Or, are they generated (in the database) by the insert execution.booleanisInherited()Determine whether the entity is inherited one or more other entities.booleanisInstance(java.lang.Object object)Is the given object an instance of this entity?booleanisInstrumented()Has the class actually been bytecode instrumented?booleanisLazyPropertiesCacheable()Should lazy properties of this entity be cached?booleanisMutable()Determine whether instances of this entity are considered mutable.booleanisSelectBeforeUpdateRequired()Is select snapshot before update enabled?booleanisSubclassEntityName(java.lang.String entityName)Determine whether the given name represents a subclass entity (or this entity itself) of the entity mapped by this persister.java.lang.BooleanisTransient(java.lang.Object object, SharedSessionContractImplementor session)Is this a new transient instance?booleanisVersioned()Determine whether optimistic locking by column is enabled for this entity.booleanisVersionPropertyGenerated()Does this entity contain a version property that is defined to be database generated?java.lang.Objectload(java.io.Serializable id, java.lang.Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session)Load an instance of the persistent class.default java.lang.Objectload(java.io.Serializable id, java.lang.Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session, java.lang.Boolean readOnly)java.lang.Objectload(java.io.Serializable id, java.lang.Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session)Load an instance of the persistent class.default java.lang.Objectload(java.io.Serializable id, java.lang.Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session, java.lang.Boolean readOnly)java.io.SerializableloadEntityIdByNaturalId(java.lang.Object[] naturalIdValues, LockOptions lockOptions, SharedSessionContractImplementor session)voidlock(java.io.Serializable id, java.lang.Object version, java.lang.Object object, LockMode lockMode, SharedSessionContractImplementor session)Do a version check (optional operation)voidlock(java.io.Serializable id, java.lang.Object version, java.lang.Object object, LockOptions lockOptions, SharedSessionContractImplementor session)Do a version check (optional operation)java.util.ListmultiLoad(java.io.Serializable[] ids, SharedSessionContractImplementor session, MultiLoadOptions loadOptions)Performs a load of multiple entities (of this type) by identifier simultaneously.voidpostInstantiate()Finish the initialization of this object.voidprocessInsertGeneratedProperties(java.io.Serializable id, java.lang.Object entity, java.lang.Object[] state, SharedSessionContractImplementor session)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.voidprocessUpdateGeneratedProperties(java.io.Serializable id, java.lang.Object entity, java.lang.Object[] state, SharedSessionContractImplementor session)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.voidresetIdentifier(java.lang.Object entity, java.io.Serializable currentId, java.lang.Object currentVersion, SharedSessionContractImplementor session)Set the identifier and version of the given instance back to its "unsaved" value.int[]resolveAttributeIndexes(java.lang.String[] attributeNames)Converts an array of attribute names to a set of indexes, according to the entity metamodeldefault int[]resolveDirtyAttributeIndexes(java.lang.Object[] values, java.lang.Object[] loadedState, java.lang.String[] attributeNames, SessionImplementor session)LikeresolveAttributeIndexes(String[])but also always returns mutable attributesvoidsetIdentifier(java.lang.Object entity, java.io.Serializable id, SharedSessionContractImplementor session)Inject the identifier value into the given entity.voidsetPropertyValue(java.lang.Object object, int i, java.lang.Object value)Set the value of a particular propertyvoidsetPropertyValues(java.lang.Object object, java.lang.Object[] values)Set the given values to the mapped properties of the given objectvoidupdate(java.io.Serializable id, java.lang.Object[] fields, int[] dirtyFields, boolean hasDirtyCollection, java.lang.Object[] oldFields, java.lang.Object oldVersion, java.lang.Object object, java.lang.Object rowId, SharedSessionContractImplementor session)Update a persistent instance-
Methods inherited from interface org.hibernate.persister.walking.spi.AttributeSource
getAttributes
-
Methods inherited from interface org.hibernate.persister.walking.spi.EntityDefinition
getEntityKeyDefinition, getEntityPersister
-
-
-
-
Field Detail
-
ENTITY_ID
static final java.lang.String ENTITY_ID
The property name of the "special" identifier property in HQL- See Also:
- Constant Field Values
-
-
Method Detail
-
generateEntityDefinition
void generateEntityDefinition()
Generate the entity definition for this object. This must be done for all entity persisters before callingpostInstantiate().
-
postInstantiate
void postInstantiate() throws MappingExceptionFinish the initialization of this object.generateEntityDefinition()must be called for all entity persisters before calling this method. Called only once perSessionFactorylifecycle, after all entity persisters have been instantiated.- Throws:
MappingException- Indicates an issue in the metadata.
-
getFactory
SessionFactoryImplementor getFactory()
Return the SessionFactory to which this persister "belongs".- Returns:
- The owning SessionFactory.
-
getNavigableRole
NavigableRole getNavigableRole()
-
getEntityEntryFactory
EntityEntryFactory getEntityEntryFactory()
Get the EntityEntryFactory indicated for the entity mapped by this persister.- Returns:
- The proper EntityEntryFactory.
-
getRootEntityName
java.lang.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
java.lang.String getEntityName()
The entity name which this persister maps.- Returns:
- The name of the entity which this persister maps.
-
getEntityMetamodel
EntityMetamodel getEntityMetamodel()
Retrieve the underlying entity metamodel instance...- Returns:
- The metamodel
-
initializeEnhancedEntityUsedAsProxy
default java.lang.Object initializeEnhancedEntityUsedAsProxy(java.lang.Object entity, java.lang.String nameOfAttributeBeingAccessed, SharedSessionContractImplementor session)Called fromEnhancementAsProxyLazinessInterceptorto 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(java.lang.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
java.io.Serializable[] 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
java.io.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 likegetPropertySpaces(), except that here we include subclass entity spaces.- Returns:
- The query spaces.
-
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.
-
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).
-
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
Type getPropertyType(java.lang.String propertyName) throws MappingException
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(java.lang.Object[] currentState, java.lang.Object[] previousState, java.lang.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(java.lang.Object[] old, java.lang.Object[] current, java.lang.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
boolean canExtractIdOutOfEntity()
Determine 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.,
or ) is enabled; false otherwise.
-
getVersionType
VersionType 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.
-
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 (hasNaturalIdentifier()), which properties make up the natural id.- Returns:
- The indices of the properties making of the natural id; or null, if no natural id is defined.
-
getNaturalIdentifierSnapshot
java.lang.Object[] getNaturalIdentifierSnapshot(java.io.Serializable 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
IdentifierGenerator getIdentifierGenerator()
Determine which identifier generation strategy is used for this entity.- Returns:
- The identifier generation strategy.
-
hasLazyProperties
boolean hasLazyProperties()
Determine whether this entity defines any lazy properties (ala bytecode instrumentation).- Returns:
- True if the entity has properties mapped as lazy; false otherwise.
-
loadEntityIdByNaturalId
@Deprecated java.io.Serializable loadEntityIdByNaturalId(java.lang.Object[] naturalIdValues, LockOptions lockOptions, SharedSessionContractImplementor session)Deprecated.Load the id for the entity based on the natural id.
-
load
java.lang.Object load(java.io.Serializable id, java.lang.Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session) throws HibernateExceptionLoad an instance of the persistent class.- Throws:
HibernateException
-
load
default java.lang.Object load(java.io.Serializable id, java.lang.Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session, java.lang.Boolean readOnly) throws HibernateException- Throws:
HibernateException
-
load
java.lang.Object load(java.io.Serializable id, java.lang.Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session) throws HibernateExceptionLoad an instance of the persistent class.- Throws:
HibernateException
-
load
default java.lang.Object load(java.io.Serializable id, java.lang.Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session, java.lang.Boolean readOnly) throws HibernateException- Throws:
HibernateException
-
multiLoad
java.util.List multiLoad(java.io.Serializable[] ids, SharedSessionContractImplementor session, MultiLoadOptions 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
-
lock
void lock(java.io.Serializable id, java.lang.Object version, java.lang.Object object, LockMode lockMode, SharedSessionContractImplementor session) throws HibernateExceptionDo a version check (optional operation)- Throws:
HibernateException
-
lock
void lock(java.io.Serializable id, java.lang.Object version, java.lang.Object object, LockOptions lockOptions, SharedSessionContractImplementor session) throws HibernateExceptionDo a version check (optional operation)- Throws:
HibernateException
-
insert
void insert(java.io.Serializable id, java.lang.Object[] fields, java.lang.Object object, SharedSessionContractImplementor session) throws HibernateExceptionPersist an instance- Throws:
HibernateException
-
insert
java.io.Serializable insert(java.lang.Object[] fields, java.lang.Object object, SharedSessionContractImplementor session) throws HibernateExceptionPersist an instance, using a natively generated identifier (optional operation)- Throws:
HibernateException
-
delete
void delete(java.io.Serializable id, java.lang.Object version, java.lang.Object object, SharedSessionContractImplementor session) throws HibernateExceptionDelete a persistent instance- Throws:
HibernateException
-
update
void update(java.io.Serializable id, java.lang.Object[] fields, int[] dirtyFields, boolean hasDirtyCollection, java.lang.Object[] oldFields, java.lang.Object oldVersion, java.lang.Object object, java.lang.Object rowId, SharedSessionContractImplementor session) throws HibernateExceptionUpdate a persistent instance- Throws:
HibernateException
-
getPropertyTypes
Type[] getPropertyTypes()
Get the Hibernate types of the class properties
-
getPropertyNames
java.lang.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)
-
getPropertyInsertGenerationInclusions
@Deprecated ValueInclusion[] getPropertyInsertGenerationInclusions()
Deprecated.Replaced internally with InMemoryValueGenerationStrategy / InDatabaseValueGenerationStrategyWhich of the properties of this class are database generated values on insert?
-
getPropertyUpdateGenerationInclusions
@Deprecated ValueInclusion[] getPropertyUpdateGenerationInclusions()
Deprecated.Replaced internally with InMemoryValueGenerationStrategy / InDatabaseValueGenerationStrategyWhich of the properties of this class are database generated values on update?
-
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)
-
getIdentifierType
Type getIdentifierType()
Get the identifier type
-
getIdentifierPropertyName
java.lang.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(java.lang.Object entity, java.lang.Object[] state, java.lang.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
ClassMetadata getClassMetadata()
Get the user-visible metadata for the class (optional operation)
-
isBatchLoadable
boolean isBatchLoadable()
Is batch loading enabled?
-
isSelectBeforeUpdateRequired
boolean isSelectBeforeUpdateRequired()
Is select snapshot before update enabled?
-
getDatabaseSnapshot
java.lang.Object[] getDatabaseSnapshot(java.io.Serializable id, SharedSessionContractImplementor session) throws HibernateExceptionGet 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
java.io.Serializable getIdByUniqueKey(java.io.Serializable key, java.lang.String uniquePropertyName, SharedSessionContractImplementor session)
-
getCurrentVersion
java.lang.Object getCurrentVersion(java.io.Serializable id, SharedSessionContractImplementor session) throws HibernateExceptionGet 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
java.lang.Object forceVersionIncrement(java.io.Serializable id, java.lang.Object currentVersion, 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(java.lang.Object entity, SharedSessionContractImplementor session)Called just after the entities properties have been initialized
-
afterReassociate
void afterReassociate(java.lang.Object entity, SharedSessionContractImplementor session)Called just after the entity has been reassociated with the session
-
createProxy
java.lang.Object createProxy(java.io.Serializable id, SharedSessionContractImplementor session) throws HibernateExceptionCreate a new proxy instance- Throws:
HibernateException
-
isTransient
java.lang.Boolean isTransient(java.lang.Object object, SharedSessionContractImplementor session) throws HibernateExceptionIs this a new transient instance?- Throws:
HibernateException
-
getPropertyValuesToInsert
java.lang.Object[] getPropertyValuesToInsert(java.lang.Object object, java.util.Map mergeMap, SharedSessionContractImplementor session) throws HibernateExceptionReturn the values of the insertable properties of the object (including backrefs)- Throws:
HibernateException
-
processInsertGeneratedProperties
void processInsertGeneratedProperties(java.io.Serializable id, java.lang.Object entity, java.lang.Object[] state, SharedSessionContractImplementor session)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.- Parameters:
id- The entity's id value.entity- The entity for which to get the state.state-session- The session
-
processUpdateGeneratedProperties
void processUpdateGeneratedProperties(java.io.Serializable id, java.lang.Object entity, java.lang.Object[] state, SharedSessionContractImplementor session)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.- Parameters:
id- The entity's id value.entity- The entity for which to get the state.state-session- The session
-
getMappedClass
java.lang.Class getMappedClass()
The persistent class, or null
-
implementsLifecycle
boolean implementsLifecycle()
Does the class implement theLifecycleinterface.
-
getConcreteProxyClass
java.lang.Class getConcreteProxyClass()
Get the proxy interface that instances of this concrete class will be cast to (optional operation).
-
setPropertyValues
void setPropertyValues(java.lang.Object object, java.lang.Object[] values)Set the given values to the mapped properties of the given object
-
setPropertyValue
void setPropertyValue(java.lang.Object object, int i, java.lang.Object value)Set the value of a particular property
-
getPropertyValues
java.lang.Object[] getPropertyValues(java.lang.Object object)
Return the (loaded) values of the mapped properties of the object (not including backrefs)
-
getPropertyValue
java.lang.Object getPropertyValue(java.lang.Object object, int i) throws HibernateExceptionGet the value of a particular property- Throws:
HibernateException
-
getPropertyValue
java.lang.Object getPropertyValue(java.lang.Object object, java.lang.String propertyName)Get the value of a particular property
-
getIdentifier
@Deprecated java.io.Serializable getIdentifier(java.lang.Object object) throws HibernateExceptionDeprecated.Get the identifier of an instance (throw an exception if no identifier property)- Throws:
HibernateException
-
getIdentifier
java.io.Serializable getIdentifier(java.lang.Object entity, SharedSessionContractImplementor session)Get the identifier of an instance (throw an exception if no identifier property)- Parameters:
entity- The entity for which to get the identifiersession- The session from which the request originated- Returns:
- The identifier
-
setIdentifier
void setIdentifier(java.lang.Object entity, java.io.Serializable id, SharedSessionContractImplementor session)Inject the identifier value into the given entity.- Parameters:
entity- The entity to inject with the identifier value.id- The value to be injected as the identifier.session- The session from which is requests originates
-
getVersion
java.lang.Object getVersion(java.lang.Object object) throws HibernateExceptionGet the version number (or timestamp) from the object's version property (or return null if not versioned)- Throws:
HibernateException
-
instantiate
java.lang.Object instantiate(java.io.Serializable 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(java.lang.Object object)
Is the given object an instance of this entity?
-
hasUninitializedLazyProperties
boolean hasUninitializedLazyProperties(java.lang.Object object)
Does the given instance have any uninitialized lazy properties?
-
resetIdentifier
void resetIdentifier(java.lang.Object entity, java.io.Serializable currentId, java.lang.Object currentVersion, SharedSessionContractImplementor session)Set the identifier and version of the given instance back to its "unsaved" value.- Parameters:
entity- The entity instancecurrentId- The currently assigned identifier value.currentVersion- The currently assigned version value.session- The session from which the request originated.
-
getSubclassEntityPersister
EntityPersister getSubclassEntityPersister(java.lang.Object instance, SessionFactoryImplementor factory)
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 re-route 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 of Cat which is a subclass of Animal. So, here the Animal persister is being asked to return the persister specific to Cat. It is also possible that the instance is actually an Animal instance in the above example in which case we would return this 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.
-
getEntityMode
EntityMode getEntityMode()
-
getEntityTuplizer
EntityTuplizer getEntityTuplizer()
-
getInstrumentationMetadata
BytecodeEnhancementMetadata getInstrumentationMetadata()
-
getBytecodeEnhancementMetadata
default BytecodeEnhancementMetadata getBytecodeEnhancementMetadata()
-
getFilterAliasGenerator
org.hibernate.internal.FilterAliasGenerator getFilterAliasGenerator(java.lang.String rootAlias)
-
resolveAttributeIndexes
int[] resolveAttributeIndexes(java.lang.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(java.lang.Object[] values, java.lang.Object[] loadedState, java.lang.String[] attributeNames, SessionImplementor session)LikeresolveAttributeIndexes(String[])but also always returns mutable attributes- Parameters:
values-loadedState-attributeNames- Array of names to be resolvedsession-- Returns:
- A set of unique indexes of the attribute names found in the metamodel
-
canUseReferenceCacheEntries
boolean canUseReferenceCacheEntries()
-
canIdentityInsertBeDelayed
@Deprecated default boolean canIdentityInsertBeDelayed()
Deprecated.Since 5.4.1, this is no longer used.
-
-