Package org.hibernate.engine.spi
Interface EntityEntry
- All Known Implementing Classes:
EntityEntryImpl
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
Modifier and TypeMethodDescriptionvoidaddExtraState(EntityEntryExtraState extraState) voidforceLocked(Object entity, Object nextVersion) Object[]Get theEntityKeyfor this entry.<T extends EntityEntryExtraState>
TgetExtraState(Class<T> extraStateType) getId()Object[]getLoadedValue(String propertyName) @Nullable ImmutableBitSetHas a bit set for every attribute position that is potentially lazy.getRowId()booleanbooleanbooleanCan the entity be modified?booleanisNullifiable(boolean earlyInsert, SharedSessionContractImplementor session) booleanvoidoverwriteLoadedStateCollectionValue(String propertyName, PersistentCollection<?> collection) voidAfter actually deleting a row, record the fact that the instance no longer exists in the database.voidpostInsert(Object version) voidpostInsert(Object[] insertedState) After actually inserting a row, record the fact that the instance exists in the database (needed for identity column key generation).voidvoidpostUpdate(Object entity, Object[] updatedState, Object nextVersion) Handle updating the internal state of the entry after actually performing the database update.booleanrequiresDirtyCheck(Object entity) Returnstrueif the entity can possibly be dirty.voidCustom serialization routine used during serialization of aSession/PersistenceContextfor increased performance.voidsetDeletedState(Object[] deletedState) voidsetLockMode(LockMode lockMode) voidsetMaybeLazySet(@Nullable ImmutableBitSet maybeLazySet) voidsetReadOnly(boolean readOnly, Object entity) voidtoString()
-
Method Details
-
getLockMode
LockMode getLockMode() -
setLockMode
-
getStatus
Status getStatus() -
setStatus
-
getId
Object getId() -
getLoadedState
Object[] getLoadedState() -
getLoadedValue
-
overwriteLoadedStateCollectionValue
-
getDeletedState
Object[] getDeletedState() -
setDeletedState
-
isExistsInDatabase
boolean isExistsInDatabase() -
getVersion
Object getVersion() -
postInsert
-
getPersister
EntityPersister getPersister() -
getEntityKey
EntityKey getEntityKey()Get theEntityKeyfor this entry.- Returns:
- the
EntityKey - Throws:
IllegalStateException- ifgetId()is null
-
getEntityName
String getEntityName() -
isBeingReplicated
boolean isBeingReplicated() -
getRowId
Object getRowId() -
postLoad
-
postUpdate
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
After actually inserting a row, record the fact that the instance exists in the database (needed for identity column key generation). -
requiresDirtyCheck
Returnstrueif 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:
trueindicates that the entity could possibly be dirty and that the dirty-check should happen;falseindicates 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,
-
forceLocked
-
isReadOnly
boolean isReadOnly() -
setReadOnly
-
getMaybeLazySet
Has a bit set for every attribute position that is potentially lazy. Whennull, no knowledge is available and every attribute must be assumed potentially lazy. -
setMaybeLazySet
-
toString
String toString() -
serialize
Custom serialization routine used during serialization of aSession/PersistenceContextfor increased performance.- Parameters:
oos- The stream to which we should write the serial data.- Throws:
IOException- If a stream error occurs
-
addExtraState
-
getExtraState
-