org.hibernate.persister.entity

Interface EntityPersister

All Superinterfaces:
OptimisticCacheSource
Known Subinterfaces:
Loadable, Lockable, OuterJoinLoadable, PostInsertIdentityPersister, Queryable, SQLLoadable, UniqueKeyLoadable
Known Implementing Classes:
AbstractEntityPersister, JoinedSubclassEntityPersister, SingleTableEntityPersister, UnionSubclassEntityPersister

public interface EntityPersister
extends OptimisticCacheSource

Implementors define mapping and persistence logic for a particular strategy of entity mapping. An instance of entity persisters corresponds to a given mapped entity.

Implementors must be threadsafe (preferrably immutable) and must provide a constructor matching the signature of: PersistentClass, SessionFactoryImplementor

Author:
Gavin King

Field Summary

static String
ENTITY_ID
The property name of the "special" identifier property in HQL

Method Summary

void
afterInitialize(Object entity, boolean lazyPropertiesAreUnfetched, SessionImplementor session)
Called just after the entities properties have been initialized
void
afterReassociate(Object entity, SessionImplementor session)
Called just after the entity has been reassociated with the session
boolean
canExtractIdOutOfEntity()
Determine whether detahced instances of this entity carry their own identifier value.
Object
createProxy(Serializable id, SessionImplementor session)
Create a new proxy instance
void
delete(Serializable id, Object version, Object object, SessionImplementor session)
Delete a persistent instance
int[]
findDirty(Object[] currentState, Object[] previousState, Object owner, SessionImplementor session)
Compare the two snapshots to determine if they represent dirty state.
int[]
findModified(Object[] old, Object[] current, Object object, SessionImplementor session)
Compare the two snapshots to determine if they represent modified state.
Object
forceVersionIncrement(Serializable id, Object currentVersion, SessionImplementor session)
EntityRegionAccessStrategy
getCacheAccessStrategy()
Get the cache (optional operation)
CacheEntryStructure
getCacheEntryStructure()
Get the cache structure
ClassMetadata
getClassMetadata()
Get the user-visible metadata for the class (optional operation)
Class
getConcreteProxyClass(EntityMode entityMode)
Get the proxy interface that instances of this concrete class will be cast to (optional operation).
Object
getCurrentVersion(Serializable id, SessionImplementor session)
Get the current version of the object, or return null if there is no row for the given identifier.
Object[]
getDatabaseSnapshot(Serializable id, SessionImplementor session)
Get the current database state of the object, in a "hydrated" form, without resolving identifiers
EntityMetamodel
getEntityMetamodel()
Retrieve the underlying entity metamodel instance...
String
getEntityName()
The entity name which this persister maps.
SessionFactoryImplementor
getFactory()
Return the SessionFactory to which this persister "belongs".
Serializable
getIdentifier(Object object, EntityMode entityMode)
Get the identifier of an instance (throw an exception if no identifier property)
IdentifierGenerator
getIdentifierGenerator()
Determine which identifier generation strategy is used for this entity.
String
getIdentifierPropertyName()
Get the name of the identifier property (or return null) - need not return the name of an actual Java property
Type
getIdentifierType()
Get the identifier type
Class
getMappedClass(EntityMode entityMode)
The persistent class, or null
int[]
getNaturalIdentifierProperties()
If the entity defines a natural id (hasNaturalIdentifier()), which properties make up the natural id.
Object[]
getNaturalIdentifierSnapshot(Serializable id, SessionImplementor session)
Retrieve the current state of the natural-id properties from the database.
CascadeStyle[]
getPropertyCascadeStyles()
Get the cascade styles of the propertes (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)
ValueInclusion[]
getPropertyInsertGenerationInclusions()
Which of the properties of this class are database generated values on insert?
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 class
Serializable[]
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)
Get the type of a particular property by name.
Type[]
getPropertyTypes()
Get the Hibernate types of the class properties
ValueInclusion[]
getPropertyUpdateGenerationInclusions()
Which of the properties of this class are database generated values on update?
boolean[]
getPropertyUpdateability()
Get the "updateability" of the properties of this class (does the property appear in an SQL UPDATE)
Object
getPropertyValue(Object object, String propertyName, EntityMode entityMode)
Get the value of a particular property
Object
getPropertyValue(Object object, int i, EntityMode entityMode)
Get the value of a particular property
Object[]
getPropertyValues(Object object, EntityMode entityMode)
Return the (loaded) values of the mapped properties of the object (not including backrefs)
Object[]
getPropertyValuesToInsert(Object object, Map mergeMap, SessionImplementor 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.
String
getRootEntityName()
Returns an object that identifies the space in which identifiers of this entity hierarchy are unique.
EntityPersister
getSubclassEntityPersister(Object instance, SessionFactoryImplementor factory, EntityMode entityMode)
Get the persister for an instance of this class or a subclass
Object
getVersion(Object object, EntityMode entityMode)
Get the version number (or timestamp) from the object's version property (or return null if not versioned)
int
getVersionProperty()
If isVersioned(), then what is the index of the property holding the locking value.
VersionType
getVersionType()
If isVersioned(), then what is the type of the property holding the locking value.
EntityMode
guessEntityMode(Object object)
Try to discover the entity mode from the entity instance
boolean
hasCache()
Does this class have a cache.
boolean
hasCascades()
Determine whether this entity has any non-none cascading.
boolean
hasCollections()
Determine whether this entity contains references to persistent collections.
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 (ala bytecode instrumentation).
boolean
hasMutableProperties()
Determine whether any properties of this entity are considered mutable.
boolean
hasNaturalIdentifier()
Determine whether this entity defines a natural identifier.
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, EntityMode entityMode)
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(EntityMode entityMode)
Does the class implement the Lifecycle interface.
boolean
implementsValidatable(EntityMode entityMode)
Does the class implement the Validatable interface.
Serializable
insert(Object[] fields, Object object, SessionImplementor session)
Persist an instance, using a natively generated identifier (optional operation)
void
insert(Serializable id, Object[] fields, Object object, SessionImplementor session)
Persist an instance
Object
instantiate(Serializable id, EntityMode entityMode)
Create a class instance initialized with the given identifier
boolean
isBatchLoadable()
Is batch loading enabled?
boolean
isCacheInvalidationRequired()
Should we always invalidate the cache instead of recaching updated state
boolean
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, EntityMode entityMode)
Is the given object an instance of this entity?
boolean
isInstrumented(EntityMode entityMode)
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.
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, SessionImplementor session)
Is this a new transient instance?
boolean
isVersionPropertyGenerated()
Does this entity contain a version property that is defined to be database generated?
boolean
isVersioned()
Determine whether optimistic locking by column is enabled for this entity.
Object
load(Serializable id, Object optionalObject, LockMode lockMode, SessionImplementor session)
Load an instance of the persistent class.
void
lock(Serializable id, Object version, Object object, LockMode lockMode, SessionImplementor session)
Do a version check (optional operation)
void
postInstantiate()
Finish the initialization of this object.
void
processInsertGeneratedProperties(Serializable id, Object entity, Object[] state, SessionImplementor 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 the PersistenceContext.
void
processUpdateGeneratedProperties(Serializable id, Object entity, Object[] state, SessionImplementor 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 the PersistenceContext.
void
resetIdentifier(Object entity, Serializable currentId, Object currentVersion, EntityMode entityMode)
Set the identifier and version of the given instance back to its "unsaved" value, returning the id
void
setIdentifier(Object object, Serializable id, EntityMode entityMode)
Set the identifier of an instance (or do nothing if no identifier property)
void
setPropertyValue(Object object, int i, Object value, EntityMode entityMode)
Set the value of a particular property
void
setPropertyValues(Object object, Object[] values, EntityMode entityMode)
Set the given values to the mapped properties of the given object
void
update(Serializable id, Object[] fields, int[] dirtyFields, boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object object, Object rowId, SessionImplementor session)
Update a persistent instance

Methods inherited from interface org.hibernate.cache.OptimisticCacheSource

getVersionComparator, isVersioned

Field Details

ENTITY_ID

public static final String ENTITY_ID
The property name of the "special" identifier property in HQL

Method Details

afterInitialize

public void afterInitialize(Object entity,
                            boolean lazyPropertiesAreUnfetched,
                            SessionImplementor session)
Called just after the entities properties have been initialized

afterReassociate

public void afterReassociate(Object entity,
                             SessionImplementor session)
Called just after the entity has been reassociated with the session

canExtractIdOutOfEntity

public boolean canExtractIdOutOfEntity()
Determine whether detahced instances of this entity carry their own identifier value.

The other option is the deperecated 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.

createProxy

public Object createProxy(Serializable id,
                          SessionImplementor session)
            throws HibernateException
Create a new proxy instance

delete

public void delete(Serializable id,
                   Object version,
                   Object object,
                   SessionImplementor session)
            throws HibernateException
Delete a persistent instance

findDirty

public int[] findDirty(Object[] currentState,
                       Object[] previousState,
                       Object owner,
                       SessionImplementor session)
Compare the two snapshots to determine if they represent dirty state.
Parameters:
currentState - The current snapshot
previousState - The baseline snapshot
owner - The entity containing the state
session - The originating session
Returns:
The indices of all dirty properties, or null if no properties were dirty.

findModified

public int[] findModified(Object[] old,
                          Object[] current,
                          Object object,
                          SessionImplementor session)
Compare the two snapshots to determine if they represent modified state.
Parameters:
old - The baseline snapshot
current - The current snapshot
object - The entity containing the state
session - The originating session
Returns:
The indices of all modified properties, or null if no properties were modified.

forceVersionIncrement

public Object forceVersionIncrement(Serializable id,
                                    Object currentVersion,
                                    SessionImplementor session)
            throws HibernateException

getCacheAccessStrategy

public EntityRegionAccessStrategy getCacheAccessStrategy()
Get the cache (optional operation)

getCacheEntryStructure

public CacheEntryStructure getCacheEntryStructure()
Get the cache structure

getClassMetadata

public ClassMetadata getClassMetadata()
Get the user-visible metadata for the class (optional operation)

getConcreteProxyClass

public Class getConcreteProxyClass(EntityMode entityMode)
Get the proxy interface that instances of this concrete class will be cast to (optional operation).

getCurrentVersion

public Object getCurrentVersion(Serializable id,
                                SessionImplementor 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.

getDatabaseSnapshot

public Object[] getDatabaseSnapshot(Serializable id,
                                    SessionImplementor 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

getEntityMetamodel

public EntityMetamodel getEntityMetamodel()
Retrieve the underlying entity metamodel instance...
Returns:
The metamodel

getEntityName

public String getEntityName()
The entity name which this persister maps.
Returns:
The name of the entity which this persister maps.

getFactory

public SessionFactoryImplementor getFactory()
Return the SessionFactory to which this persister "belongs".
Returns:
The owning SessionFactory.

getIdentifier

public Serializable getIdentifier(Object object,
                                  EntityMode entityMode)
            throws HibernateException
Get the identifier of an instance (throw an exception if no identifier property)

getIdentifierGenerator

public IdentifierGenerator getIdentifierGenerator()
Determine which identifier generation strategy is used for this entity.
Returns:
The identifier generation strategy.

getIdentifierPropertyName

public String getIdentifierPropertyName()
Get the name of the identifier property (or return null) - need not return the name of an actual Java property

getIdentifierType

public Type getIdentifierType()
Get the identifier type

getMappedClass

public Class getMappedClass(EntityMode entityMode)
The persistent class, or null

getNaturalIdentifierProperties

public 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

public Object[] getNaturalIdentifierSnapshot(Serializable id,
                                             SessionImplementor 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 naturak-id values.
session - The session from which the request originated.
Returns:
The natural-id snapshot.

getPropertyCascadeStyles

public CascadeStyle[] getPropertyCascadeStyles()
Get the cascade styles of the propertes (optional operation)

getPropertyCheckability

public boolean[] getPropertyCheckability()
Get the "checkability" of the properties of this class (is the property dirty checked, does the cache need to be updated)

getPropertyInsertGenerationInclusions

public ValueInclusion[] getPropertyInsertGenerationInclusions()
Which of the properties of this class are database generated values on insert?

getPropertyInsertability

public boolean[] getPropertyInsertability()
Get the "insertability" of the properties of this class (does the property appear in an SQL INSERT)

getPropertyLaziness

public boolean[] getPropertyLaziness()

getPropertyNames

public 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)

getPropertyNullability

public boolean[] getPropertyNullability()
Get the nullability of the properties of this class

getPropertySpaces

public 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.

getPropertyType

public Type getPropertyType(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 typpe.
Returns:
The type.
Throws:
MappingException - Typically indicates an unknown property name.

getPropertyTypes

public Type[] getPropertyTypes()
Get the Hibernate types of the class properties

getPropertyUpdateGenerationInclusions

public ValueInclusion[] getPropertyUpdateGenerationInclusions()
Which of the properties of this class are database generated values on update?

getPropertyUpdateability

public boolean[] getPropertyUpdateability()
Get the "updateability" of the properties of this class (does the property appear in an SQL UPDATE)

getPropertyValue

public Object getPropertyValue(Object object,
                               String propertyName,
                               EntityMode entityMode)
            throws HibernateException
Get the value of a particular property

getPropertyValue

public Object getPropertyValue(Object object,
                               int i,
                               EntityMode entityMode)
            throws HibernateException
Get the value of a particular property

getPropertyValues

public Object[] getPropertyValues(Object object,
                                  EntityMode entityMode)
            throws HibernateException
Return the (loaded) values of the mapped properties of the object (not including backrefs)

getPropertyValuesToInsert

public Object[] getPropertyValuesToInsert(Object object,
                                          Map mergeMap,
                                          SessionImplementor session)
            throws HibernateException
Return the values of the insertable properties of the object (including backrefs)

getPropertyVersionability

public boolean[] getPropertyVersionability()
Get the "versionability" of the properties of this class (is the property optimistic-locked)

getQuerySpaces

public Serializable[] getQuerySpaces()
Returns:
The query spaces.

getRootEntityName

public 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.

getSubclassEntityPersister

public EntityPersister getSubclassEntityPersister(Object instance,
                                                  SessionFactoryImplementor factory,
                                                  EntityMode entityMode)
Get the persister for an instance of this class or a subclass

getVersion

public Object getVersion(Object object,
                         EntityMode entityMode)
            throws HibernateException
Get the version number (or timestamp) from the object's version property (or return null if not versioned)

getVersionProperty

public int getVersionProperty()
If isVersioned(), then what is the index of the property holding the locking value.
Returns:
The type of the version property; or -66, if not versioned.

getVersionType

public VersionType getVersionType()
If isVersioned(), then what is the type of the property holding the locking value.
Returns:
The type of the version property; or null, if not versioned.

guessEntityMode

public EntityMode guessEntityMode(Object object)
Try to discover the entity mode from the entity instance

hasCache

public boolean hasCache()
Does this class have a cache.

hasCascades

public boolean hasCascades()
Determine whether this entity has any non-none cascading.
Returns:
True if the entity has any properties with a cscade other than NONE; false otherwise (aka, no cascading).

hasCollections

public boolean hasCollections()
Determine whether this entity contains references to persistent collections.
Returns:
True if the entity does contain persistent collections; false otherwise.

hasIdentifierProperty

public 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.

hasInsertGeneratedProperties

public 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).

hasLazyProperties

public 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.

hasMutableProperties

public 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).

hasNaturalIdentifier

public boolean hasNaturalIdentifier()
Determine whether this entity defines a natural identifier.
Returns:
True if the entity defines a natural id; false otherwise.

hasProxy

public boolean hasProxy()
Determine whether this entity supports dynamic proxies.
Returns:
True if the entity has dynamic proxy support; false otherwise.

hasSubselectLoadableCollections

public 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.

hasUninitializedLazyProperties

public boolean hasUninitializedLazyProperties(Object object,
                                              EntityMode entityMode)
Does the given instance have any uninitialized lazy properties?

hasUpdateGeneratedProperties

public 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).

implementsLifecycle

public boolean implementsLifecycle(EntityMode entityMode)
Does the class implement the Lifecycle interface.

implementsValidatable

public boolean implementsValidatable(EntityMode entityMode)
Does the class implement the Validatable interface.

insert

public Serializable insert(Object[] fields,
                           Object object,
                           SessionImplementor session)
            throws HibernateException
Persist an instance, using a natively generated identifier (optional operation)

insert

public void insert(Serializable id,
                   Object[] fields,
                   Object object,
                   SessionImplementor session)
            throws HibernateException
Persist an instance

instantiate

public Object instantiate(Serializable id,
                          EntityMode entityMode)
            throws HibernateException
Create a class instance initialized with the given identifier

isBatchLoadable

public boolean isBatchLoadable()
Is batch loading enabled?

isCacheInvalidationRequired

public boolean isCacheInvalidationRequired()
Should we always invalidate the cache instead of recaching updated state

isIdentifierAssignedByInsert

public 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.

isInherited

public 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.

isInstance

public boolean isInstance(Object object,
                          EntityMode entityMode)
Is the given object an instance of this entity?

isInstrumented

public boolean isInstrumented(EntityMode entityMode)
Has the class actually been bytecode instrumented?

isLazyPropertiesCacheable

public boolean isLazyPropertiesCacheable()
Should lazy properties of this entity be cached?

isMutable

public boolean isMutable()
Determine whether instances of this entity are considered mutable.
Returns:
True if the entity is considered mutable; false otherwise.

isSelectBeforeUpdateRequired

public boolean isSelectBeforeUpdateRequired()
Is select snapshot before update enabled?

isSubclassEntityName

public 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.

isTransient

public Boolean isTransient(Object object,
                           SessionImplementor session)
            throws HibernateException
Is this a new transient instance?

isVersionPropertyGenerated

public 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.

isVersioned

public boolean isVersioned()
Determine whether optimistic locking by column is enabled for this entity.
Specified by:
isVersioned in interface OptimisticCacheSource
Returns:
True if optimistic locking by column (i.e., or ) is enabled; false otherwise.

load

public Object load(Serializable id,
                   Object optionalObject,
                   LockMode lockMode,
                   SessionImplementor session)
            throws HibernateException
Load an instance of the persistent class.

lock

public void lock(Serializable id,
                 Object version,
                 Object object,
                 LockMode lockMode,
                 SessionImplementor session)
            throws HibernateException
Do a version check (optional operation)

postInstantiate

public void postInstantiate()
            throws MappingException
Finish the initialization of this object.

Called only once per SessionFactory lifecycle, after all entity persisters have been instantiated.

Throws:
MappingException - Indicates an issue in the metdata.

processInsertGeneratedProperties

public void processInsertGeneratedProperties(Serializable id,
                                             Object entity,
                                             Object[] state,
                                             SessionImplementor 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 the PersistenceContext.

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

public void processUpdateGeneratedProperties(Serializable id,
                                             Object entity,
                                             Object[] state,
                                             SessionImplementor 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 the PersistenceContext.

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

resetIdentifier

public void resetIdentifier(Object entity,
                            Serializable currentId,
                            Object currentVersion,
                            EntityMode entityMode)
Set the identifier and version of the given instance back to its "unsaved" value, returning the id
Parameters:
currentId - TODO
currentVersion - TODO

setIdentifier

public void setIdentifier(Object object,
                          Serializable id,
                          EntityMode entityMode)
            throws HibernateException
Set the identifier of an instance (or do nothing if no identifier property)

setPropertyValue

public void setPropertyValue(Object object,
                             int i,
                             Object value,
                             EntityMode entityMode)
            throws HibernateException
Set the value of a particular property

setPropertyValues

public void setPropertyValues(Object object,
                              Object[] values,
                              EntityMode entityMode)
            throws HibernateException
Set the given values to the mapped properties of the given object

update

public void update(Serializable id,
                   Object[] fields,
                   int[] dirtyFields,
                   boolean hasDirtyCollection,
                   Object[] oldFields,
                   Object oldVersion,
                   Object object,
                   Object rowId,
                   SessionImplementor session)
            throws HibernateException
Update a persistent instance