Package org.hibernate.engine.spi
Interface EntityEntry
-
- All Known Implementing Classes:
AbstractEntityEntry
,ImmutableEntityEntry
,MutableEntityEntry
public interface EntityEntry
Information about the current state of a managed entity instance with respect to its persistent state.- Implementation Note:
- Hibernate instantiates very many of instances of this type, and so we need to take care of its impact on memory consumption.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addExtraState(EntityEntryExtraState extraState)
void
forceLocked(Object entity, Object nextVersion)
Object[]
getDeletedState()
EntityKey
getEntityKey()
Get theEntityKey
for this entry.String
getEntityName()
<T extends EntityEntryExtraState>
TgetExtraState(Class<T> extraStateType)
Object
getId()
Object[]
getLoadedState()
Object
getLoadedValue(String propertyName)
LockMode
getLockMode()
EntityPersister
getPersister()
Object
getRowId()
Status
getStatus()
Object
getVersion()
boolean
isBeingReplicated()
boolean
isExistsInDatabase()
boolean
isModifiableEntity()
Can the entity be modified?boolean
isNullifiable(boolean earlyInsert, SharedSessionContractImplementor session)
boolean
isReadOnly()
void
overwriteLoadedStateCollectionValue(String propertyName, PersistentCollection<?> collection)
void
postDelete()
After actually deleting a row, record the fact that the instance no longer exists in the database.void
postInsert(Object version)
void
postInsert(Object[] insertedState)
After actually inserting a row, record the fact that the instance exists in the database (needed for identity column key generation).void
postUpdate(Object entity, Object[] updatedState, Object nextVersion)
Handle updating the internal state of the entry after actually performing the database update.boolean
requiresDirtyCheck(Object entity)
Returnstrue
if the entity can possibly be dirty.void
serialize(ObjectOutputStream oos)
Custom serialization routine used during serialization of aSession
/PersistenceContext
for increased performance.void
setDeletedState(Object[] deletedState)
void
setLockMode(LockMode lockMode)
void
setReadOnly(boolean readOnly, Object entity)
void
setStatus(Status status)
String
toString()
-
-
-
Method Detail
-
getLockMode
LockMode getLockMode()
-
setLockMode
void setLockMode(LockMode lockMode)
-
getStatus
Status getStatus()
-
setStatus
void setStatus(Status status)
-
getId
Object getId()
-
getLoadedState
Object[] getLoadedState()
-
overwriteLoadedStateCollectionValue
void overwriteLoadedStateCollectionValue(String propertyName, PersistentCollection<?> collection)
-
getDeletedState
Object[] getDeletedState()
-
setDeletedState
void setDeletedState(Object[] deletedState)
-
isExistsInDatabase
boolean isExistsInDatabase()
-
getVersion
Object getVersion()
-
postInsert
void postInsert(Object version)
-
getPersister
EntityPersister getPersister()
-
getEntityKey
EntityKey getEntityKey()
Get theEntityKey
for this entry.- Returns:
- the
EntityKey
- Throws:
IllegalStateException
- ifgetId()
is null
-
getEntityName
String getEntityName()
-
isBeingReplicated
boolean isBeingReplicated()
-
getRowId
Object getRowId()
-
postUpdate
void postUpdate(Object entity, Object[] updatedState, Object nextVersion)
Handle updating the internal state of the entry after actually performing the database update. Specifically, we update the snapshot information and escalate the lock mode.- Parameters:
entity
- The entity instanceupdatedState
- The state calculated after the update (becomes the newloaded state
.nextVersion
- The new version.
-
postDelete
void postDelete()
After actually deleting a row, record the fact that the instance no longer exists in the database.
-
postInsert
void postInsert(Object[] insertedState)
After actually inserting a row, record the fact that the instance exists in the database (needed for identity column key generation).
-
isNullifiable
boolean isNullifiable(boolean earlyInsert, SharedSessionContractImplementor session)
-
requiresDirtyCheck
boolean requiresDirtyCheck(Object entity)
Returnstrue
if the entity can possibly be dirty. This can only be the case if it is in a modifiable state (not read-only nor deleted) and it either has mutable properties or field-interception is not telling us that it is dirty.- Parameters:
entity
- The entity to test- Returns:
true
indicates that the entity could possibly be dirty and that the dirty-check should happen;false
indicates there is no way the entity can be dirty
-
isModifiableEntity
boolean isModifiableEntity()
Can the entity be modified?The entity is modifiable if all the following are true:
- the entity class is mutable,
- the entity is not read-only, and
- if the current status is
Status.DELETED
, then the entity was not read-only when it was deleted.
- Returns:
true
, if the entity is modifiable;false
, otherwise,
-
isReadOnly
boolean isReadOnly()
-
setReadOnly
void setReadOnly(boolean readOnly, Object entity)
-
serialize
void serialize(ObjectOutputStream oos) throws IOException
Custom serialization routine used during serialization of aSession
/PersistenceContext
for increased performance.- Parameters:
oos
- The stream to which we should write the serial data.- Throws:
IOException
- If a stream error occurs
-
addExtraState
void addExtraState(EntityEntryExtraState extraState)
-
getExtraState
<T extends EntityEntryExtraState> T getExtraState(Class<T> extraStateType)
-
-