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.
<p/>
Implementations must be thread-safe (preferably immutable).
<p/>
Unless a custom PersisterFactory
is used, it is expected
that implementations of EntityPersister define a constructor accepting the following arguments:<ol>
<li>
PersistentClass
- describes the metadata about the entity
to be handled by the persister
</li>
<li>
EntityDataAccess
- the second level caching strategy for this entity
</li>
<li>
NaturalIdDataAccess
- the second level caching strategy for the natural-id
defined for this entity, if one
</li>
<li>
PersisterCreationContext
- access to additional
information useful while constructing the persister.
</li>
</ol>
PersisterFactory
,
PersisterClassResolver
Type | Property and Description |
---|---|
boolean |
hasIdentifier
Determine whether the entity has a particular property holding
the identifier value.
|
Modifier and Type | Field and Description |
---|---|
static String |
ENTITY_ID
The property name of the "special" identifier property in HQL
|
Modifier and Type | Method and Description |
---|---|
void |
afterInitialize(Object entity,
SharedSessionContractImplementor session)
Called just after the entities properties have been initialized
|
void |
afterReassociate(Object entity,
SharedSessionContractImplementor session)
Called just after the entity has been reassociated with the session
|
CacheEntry |
buildCacheEntry(Object entity,
Object[] state,
Object version,
SharedSessionContractImplementor session) |
boolean |
canExtractIdOutOfEntity()
Determine whether detached instances of this entity carry their own
identifier value.
|
boolean |
canReadFromCache() |
boolean |
canUseReferenceCacheEntries() |
boolean |
canWriteToCache() |
Object |
createProxy(Serializable id,
SharedSessionContractImplementor session)
Create a new proxy instance
|
void |
delete(Serializable id,
Object version,
Object object,
SharedSessionContractImplementor session)
Delete a persistent instance
|
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.
|
Object |
forceVersionIncrement(Serializable id,
Object currentVersion,
SharedSessionContractImplementor session) |
void |
generateEntityDefinition()
Generate the entity definition for this object.
|
EntityDataAccess |
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()
Get the proxy interface that instances of <em>this</em> concrete class will be
cast to (optional operation).
|
Object |
getCurrentVersion(Serializable id,
SharedSessionContractImplementor session)
Get the current version of the object, or return null if there is no row for
the given identifier.
|
Object[] |
getDatabaseSnapshot(Serializable id,
SharedSessionContractImplementor session)
Get the current database state of the object, in a "hydrated" form, without
resolving identifiers
|
EntityEntryFactory |
getEntityEntryFactory()
Get the EntityEntryFactory indicated for the entity mapped by this persister.
|
EntityMetamodel |
getEntityMetamodel()
Retrieve the underlying entity metamodel instance…
|
EntityMode |
getEntityMode() |
String |
getEntityName()
The entity name which this persister maps.
|
EntityTuplizer |
getEntityTuplizer() |
SessionFactoryImplementor |
getFactory()
Return the SessionFactory to which this persister "belongs".
|
org.hibernate.internal.FilterAliasGenerator |
getFilterAliasGenerator(String rootAlias) |
Serializable |
getIdByUniqueKey(Serializable key,
String uniquePropertyName,
SharedSessionContractImplementor session) |
Serializable |
getIdentifier(Object object)
Deprecated.
|
Serializable |
getIdentifier(Object entity,
SharedSessionContractImplementor session)
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
|
BytecodeEnhancementMetadata |
getInstrumentationMetadata() |
Class |
getMappedClass()
The persistent class, or null
|
NaturalIdDataAccess |
getNaturalIdCacheAccessStrategy()
Get the NaturalId cache (optional operation)
|
int[] |
getNaturalIdentifierProperties()
If the entity defines a natural id (
hasNaturalIdentifier() ), which
properties make up the natural id. |
Object[] |
getNaturalIdentifierSnapshot(Serializable id,
SharedSessionContractImplementor session)
Retrieve the current state of the natural-id properties from the database.
|
NavigableRole |
getNavigableRole() |
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 / InDatabaseValueGenerationStrategy
|
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
|
boolean[] |
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 / InDatabaseValueGenerationStrategy
|
Object |
getPropertyValue(Object object,
int i)
Get the value of a particular property
|
Object |
getPropertyValue(Object object,
String propertyName)
Get the value of a particular property
|
Object[] |
getPropertyValues(Object object)
Return the (loaded) values of the mapped properties of the object (not including backrefs)
|
Object[] |
getPropertyValuesToInsert(Object object,
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)
|
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)
A request has already identified the entity-name of this persister as the mapping for the given instance.
|
Object |
getVersion(Object object)
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. |
boolean |
hasCache()
Deprecated.
Use
canReadFromCache() and/or canWriteToCache() depending on need |
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 |
hasNaturalIdCache()
Does this class have a natural id cache
|
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)
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 the
Lifecycle interface. |
Serializable |
insert(Object[] fields,
Object object,
SharedSessionContractImplementor session)
Persist an instance, using a natively generated identifier (optional operation)
|
void |
insert(Serializable id,
Object[] fields,
Object object,
SharedSessionContractImplementor session)
Persist an instance
|
Object |
instantiate(Serializable id,
SharedSessionContractImplementor session)
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)
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.
|
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(Serializable id,
Object optionalObject,
LockMode lockMode,
SharedSessionContractImplementor session)
Load an instance of the persistent class.
|
Object |
load(Serializable id,
Object optionalObject,
LockOptions lockOptions,
SharedSessionContractImplementor session)
Load an instance of the persistent class.
|
Serializable |
loadEntityIdByNaturalId(Object[] naturalIdValues,
LockOptions lockOptions,
SharedSessionContractImplementor session)
Load the id for the entity based on the natural id.
|
void |
lock(Serializable id,
Object version,
Object object,
LockMode lockMode,
SharedSessionContractImplementor session)
Do a version check (optional operation)
|
void |
lock(Serializable id,
Object version,
Object object,
LockOptions lockOptions,
SharedSessionContractImplementor session)
Do a version check (optional operation)
|
List |
multiLoad(Serializable[] ids,
SharedSessionContractImplementor session,
MultiLoadOptions loadOptions)
Performs a load of multiple entities (of this type) by identifier simultaneously.
|
void |
postInstantiate()
Finish the initialization of this object.
|
void |
processInsertGeneratedProperties(Serializable id,
Object entity,
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 the
PersistenceContext . |
void |
processUpdateGeneratedProperties(Serializable id,
Object entity,
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 the
PersistenceContext . |
void |
resetIdentifier(Object entity,
Serializable currentId,
Object currentVersion,
SharedSessionContractImplementor session)
Set the identifier and version of the given instance back to its "unsaved" value.
|
int[] |
resolveAttributeIndexes(String[] attributeNames)
Converts an array of attribute names to a set of indexes, according to the entity metamodel
|
void |
setIdentifier(Object entity,
Serializable id,
SharedSessionContractImplementor session)
Inject the identifier value into the given entity.
|
void |
setPropertyValue(Object object,
int i,
Object value)
Set the value of a particular property
|
void |
setPropertyValues(Object object,
Object[] values)
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,
SharedSessionContractImplementor session)
Update a persistent instance
|
getEntityKeyDefinition, getEntityPersister
getAttributes
boolean hasIdentifierProperty
Determine whether the entity has a particular property holding the identifier value.
static final String ENTITY_ID
The property name of the "special" identifier property in HQL
void generateEntityDefinition()
Generate the entity definition for this object. This must be done for all
entity persisters before calling postInstantiate()
.
void postInstantiate() throws MappingException
Finish the initialization of this object. generateEntityDefinition()
must be called for all entity persisters before calling this method.
<p/>
Called only once per SessionFactory
lifecycle,
after all entity persisters have been instantiated.
MappingException
- Indicates an issue in the metadata.SessionFactoryImplementor getFactory()
Return the SessionFactory to which this persister "belongs".
NavigableRole getNavigableRole()
EntityEntryFactory getEntityEntryFactory()
Get the EntityEntryFactory indicated for the entity mapped by this persister.
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.
String getEntityName()
The entity name which this persister maps.
EntityMetamodel getEntityMetamodel()
Retrieve the underlying entity metamodel instance…
boolean isSubclassEntityName(String entityName)
Determine whether the given name represents a subclass entity (or this entity itself) of the entity mapped by this persister.
entityName
- The entity name to be checked.Serializable[] getPropertySpaces()
Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class only. <p/> 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).
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.
<p/>
Much like getPropertySpaces()
, except that here we include subclass
entity spaces.
boolean hasProxy()
Determine whether this entity supports dynamic proxies.
boolean hasCollections()
Determine whether this entity contains references to persistent collections.
boolean hasMutableProperties()
Determine whether any properties of this entity are considered mutable.
boolean hasSubselectLoadableCollections()
Determine whether this entity contains references to persistent collections which are fetchable by subselect?
boolean hasCascades()
Determine whether this entity has any non-none cascading.
boolean isMutable()
Determine whether instances of this entity are considered mutable.
boolean isInherited()
Determine whether the entity is inherited one or more other entities. In other words, is this entity a subclass of other entities.
boolean isIdentifierAssignedByInsert()
Are identifiers of this entity assigned known before the insert execution? Or, are they generated (in the database) by the insert execution.
Type getPropertyType(String propertyName) throws MappingException
Get the type of a particular property by name.
propertyName
- The name of the property for which to retrieve
the type.MappingException
- Typically indicates an unknown
property name.int[] findDirty(Object[] currentState, Object[] previousState, Object owner, SharedSessionContractImplementor session)
Compare the two snapshots to determine if they represent dirty state.
currentState
- The current snapshotpreviousState
- The baseline snapshotowner
- The entity containing the statesession
- The originating sessionint[] findModified(Object[] old, Object[] current, Object object, SharedSessionContractImplementor session)
Compare the two snapshots to determine if they represent modified state.
old
- The baseline snapshotcurrent
- The current snapshotobject
- The entity containing the statesession
- The originating sessionboolean hasIdentifierProperty()
Determine whether the entity has a particular property holding the identifier value.
boolean canExtractIdOutOfEntity()
Determine whether detached instances of this entity carry their own identifier value. <p/> The other option is the deprecated feature where users could supply the id during session calls.
hasIdentifierProperty()
or
(2) the identifier is an embedded composite identifier; false otherwise.boolean isVersioned()
Determine whether optimistic locking by column is enabled for this entity.
VersionType getVersionType()
If isVersioned()
, then what is the type of the property
holding the locking value.
int getVersionProperty()
If isVersioned()
, then what is the index of the property
holding the locking value.
boolean hasNaturalIdentifier()
Determine whether this entity defines a natural identifier.
int[] getNaturalIdentifierProperties()
If the entity defines a natural id (hasNaturalIdentifier()
), which
properties make up the natural id.
Object[] getNaturalIdentifierSnapshot(Serializable id, SharedSessionContractImplementor session)
Retrieve the current state of the natural-id properties from the database.
id
- The identifier of the entity for which to retrieve the natural-id values.session
- The session from which the request originated.IdentifierGenerator getIdentifierGenerator()
Determine which identifier generation strategy is used for this entity.
boolean hasLazyProperties()
Determine whether this entity defines any lazy properties (ala bytecode instrumentation).
Serializable loadEntityIdByNaturalId(Object[] naturalIdValues, LockOptions lockOptions, SharedSessionContractImplementor session)
Load the id for the entity based on the natural id.
Object load(Serializable id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session) throws HibernateException
Load an instance of the persistent class.
HibernateException
Object load(Serializable id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session) throws HibernateException
Load an instance of the persistent class.
HibernateException
List multiLoad(Serializable[] ids, SharedSessionContractImplementor session, MultiLoadOptions loadOptions)
Performs a load of multiple entities (of this type) by identifier simultaneously.
ids
- The identifiers to loadsession
- The originating SesisonloadOptions
- The options for loadingvoid lock(Serializable id, Object version, Object object, LockMode lockMode, SharedSessionContractImplementor session) throws HibernateException
Do a version check (optional operation)
HibernateException
void lock(Serializable id, Object version, Object object, LockOptions lockOptions, SharedSessionContractImplementor session) throws HibernateException
Do a version check (optional operation)
HibernateException
void insert(Serializable id, Object[] fields, Object object, SharedSessionContractImplementor session) throws HibernateException
Persist an instance
HibernateException
Serializable insert(Object[] fields, Object object, SharedSessionContractImplementor session) throws HibernateException
Persist an instance, using a natively generated identifier (optional operation)
HibernateException
void delete(Serializable id, Object version, Object object, SharedSessionContractImplementor session) throws HibernateException
Delete a persistent instance
HibernateException
void update(Serializable id, Object[] fields, int[] dirtyFields, boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object object, Object rowId, SharedSessionContractImplementor session) throws HibernateException
Update a persistent instance
HibernateException
Type[] getPropertyTypes()
Get the Hibernate types of the class properties
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[] getPropertyInsertability()
Get the "insertability" of the properties of this class (does the property appear in an SQL INSERT)
@Deprecated ValueInclusion[] getPropertyInsertGenerationInclusions()
Which of the properties of this class are database generated values on insert?
@Deprecated 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)
boolean[] getPropertyCheckability()
Get the "checkability" of the properties of this class (is the property dirty checked, does the cache need to be updated)
boolean[] getPropertyNullability()
Get the nullability of the properties of this class
boolean[] getPropertyVersionability()
Get the "versionability" of the properties of this class (is the property optimistic-locked)
boolean[] getPropertyLaziness()
CascadeStyle[] getPropertyCascadeStyles()
Get the cascade styles of the properties (optional operation)
Type getIdentifierType()
Get the identifier type
String getIdentifierPropertyName()
Get the name of the identifier property (or return null) - need not return the name of an actual Java property
boolean isCacheInvalidationRequired()
Should we always invalidate the cache instead of recaching updated state
boolean isLazyPropertiesCacheable()
Should lazy properties of this entity be cached?
boolean canReadFromCache()
boolean canWriteToCache()
@Deprecated boolean hasCache()
canReadFromCache()
and/or canWriteToCache()
depending on needDoes this class have a cache.
EntityDataAccess getCacheAccessStrategy()
Get the cache (optional operation)
CacheEntryStructure getCacheEntryStructure()
Get the cache structure
CacheEntry buildCacheEntry(Object entity, Object[] state, Object version, SharedSessionContractImplementor session)
boolean hasNaturalIdCache()
Does this class have a natural id cache
NaturalIdDataAccess getNaturalIdCacheAccessStrategy()
Get the NaturalId cache (optional operation)
ClassMetadata getClassMetadata()
Get the user-visible metadata for the class (optional operation)
boolean isBatchLoadable()
Is batch loading enabled?
boolean isSelectBeforeUpdateRequired()
Is select snapshot before update enabled?
Object[] getDatabaseSnapshot(Serializable id, SharedSessionContractImplementor session) throws HibernateException
Get the current database state of the object, in a "hydrated" form, without resolving identifiers
HibernateException
Serializable getIdByUniqueKey(Serializable key, String uniquePropertyName, SharedSessionContractImplementor session)
Object getCurrentVersion(Serializable 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.
HibernateException
Object forceVersionIncrement(Serializable id, Object currentVersion, SharedSessionContractImplementor session) throws HibernateException
HibernateException
boolean isInstrumented()
Has the class actually been bytecode instrumented?
boolean hasInsertGeneratedProperties()
Does this entity define any properties as being database generated on insert?
boolean hasUpdateGeneratedProperties()
Does this entity define any properties as being database generated on update?
boolean isVersionPropertyGenerated()
Does this entity contain a version property that is defined to be database generated?
void afterInitialize(Object entity, SharedSessionContractImplementor session)
Called just after the entities properties have been initialized
void afterReassociate(Object entity, SharedSessionContractImplementor session)
Called just after the entity has been reassociated with the session
Object createProxy(Serializable id, SharedSessionContractImplementor session) throws HibernateException
Create a new proxy instance
HibernateException
Boolean isTransient(Object object, SharedSessionContractImplementor session) throws HibernateException
Is this a new transient instance?
HibernateException
Object[] getPropertyValuesToInsert(Object object, Map mergeMap, SharedSessionContractImplementor session) throws HibernateException
Return the values of the insertable properties of the object (including backrefs)
HibernateException
void processInsertGeneratedProperties(Serializable id, Object entity, 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 the
PersistenceContext
.
<p/>
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.
id
- The entity’s id value.entity
- The entity for which to get the state.state
- session
- The sessionvoid processUpdateGeneratedProperties(Serializable id, Object entity, 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 the
PersistenceContext
.
<p/>
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.
id
- The entity’s id value.entity
- The entity for which to get the state.state
- session
- The sessionClass getMappedClass()
The persistent class, or null
boolean implementsLifecycle()
Does the class implement the Lifecycle
interface.
Class getConcreteProxyClass()
Get the proxy interface that instances of <em>this</em> concrete class will be cast to (optional operation).
void setPropertyValues(Object object, Object[] values)
Set the given values to the mapped properties of the given object
void setPropertyValue(Object object, int i, Object value)
Set the value of a particular property
Object[] getPropertyValues(Object object)
Return the (loaded) values of the mapped properties of the object (not including backrefs)
Object getPropertyValue(Object object, int i) throws HibernateException
Get the value of a particular property
HibernateException
Object getPropertyValue(Object object, String propertyName)
Get the value of a particular property
@Deprecated Serializable getIdentifier(Object object) throws HibernateException
getIdentifier(Object,SharedSessionContractImplementor)
insteadGet the identifier of an instance (throw an exception if no identifier property)
HibernateException
Serializable getIdentifier(Object entity, SharedSessionContractImplementor session)
Get the identifier of an instance (throw an exception if no identifier property)
entity
- The entity for which to get the identifiersession
- The session from which the request originatedvoid setIdentifier(Object entity, Serializable id, SharedSessionContractImplementor session)
Inject the identifier value into the given entity.
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 originatesObject getVersion(Object object) throws HibernateException
Get the version number (or timestamp) from the object’s version property (or return null if not versioned)
HibernateException
Object instantiate(Serializable id, SharedSessionContractImplementor session)
Create a class instance initialized with the given identifier
id
- The identifier value to use (may be null to represent no value)session
- The session from which the request originated.boolean isInstance(Object object)
Is the given object an instance of this entity?
boolean hasUninitializedLazyProperties(Object object)
Does the given instance have any uninitialized lazy properties?
void resetIdentifier(Object entity, Serializable currentId, Object currentVersion, SharedSessionContractImplementor session)
Set the identifier and version of the given instance back to its "unsaved" value.
entity
- The entity instancecurrentId
- The currently assigned identifier value.currentVersion
- The currently assigned version value.session
- The session from which the request originated.EntityPersister getSubclassEntityPersister(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. <p/> For example, a request names <tt>Animal</tt> as the entity-name which gets resolved to this persister. But the actual instance is really an instance of <tt>Cat</tt> which is a subclass of <tt>Animal</tt>. So, here the <tt>Animal</tt> persister is being asked to return the persister specific to <tt>Cat</tt>. <p/> It is also possible that the instance is actually an <tt>Animal</tt> instance in the above example in which case we would return <tt>this</tt> from this method.
instance
- The entity instancefactory
- Reference to the SessionFactoryHibernateException
- Indicates that instance was deemed to not be a subclass of the entity mapped by
this persister.EntityMode getEntityMode()
EntityTuplizer getEntityTuplizer()
BytecodeEnhancementMetadata getInstrumentationMetadata()
org.hibernate.internal.FilterAliasGenerator getFilterAliasGenerator(String rootAlias)
int[] resolveAttributeIndexes(String[] attributeNames)
Converts an array of attribute names to a set of indexes, according to the entity metamodel
attributeNames
- Array of names to be resolvedboolean canUseReferenceCacheEntries()
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.