Top Description Methods
org.hibernate.engine.spi

public Interface EntityEntry

Known Direct Implementers
org.hibernate.engine.internal.AbstractEntityEntry
Imports
java.io.IOException, .ObjectOutputStream, org.hibernate.LockMode, org.hibernate.collection.spi.PersistentCollection, org.hibernate.persister.entity.EntityPersister

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.

Authors
Gavin King, Emmanuel Bernard, Gunnar Morling, Sanne Grinovero

Method Summary

Modifier and TypeMethod and Description
public void
public void
forceLocked(Object entity, Object nextVersion)

public Object[]
public EntityKey

Returns:

the EntityKey
getEntityKey
()

Get the EntityKey for this entry.

public String
public <T extends EntityEntryExtraState> T
getExtraState(Class<T> extraStateType)

public Object
public Object[]
public Object
getLoadedValue(String propertyName)

public LockMode
public EntityPersister
public Object
public Status
public Object
public boolean
public boolean
public boolean

Returns:

true, if the entity is modifiable; false, otherwise,
isModifiableEntity
()

Can the entity be modified?

public boolean
isNullifiable(boolean earlyInsert, SharedSessionContractImplementor session)

public boolean
public void
public void
postDelete()

After actually deleting a row, record the fact that the instance no longer exists in the database.

public void
postInsert(Object version)

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

public void
postUpdate(Object
The entity instance
entity
,
Object[]
The state calculated after the update (becomes the new loaded state.
updatedState
,
Object
The new version.
nextVersion
)

Handle updating the internal state of the entry after actually performing the database update.

public boolean

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
requiresDirtyCheck
(Object
The entity to test
entity
)

Returns true if the entity can possibly be dirty.

public void
serialize(ObjectOutputStream
The stream to which we should write the serial data.
oos
)

Custom serialization routine used during serialization of a Session/PersistenceContext for increased performance.

public void
setDeletedState(Object[] deletedState)

public void
public void
setReadOnly(boolean readOnly, Object entity)

public void
setStatus(Status status)

public String

Method Detail

addExtraStateback to summary
public void addExtraState(EntityEntryExtraState extraState)
forceLockedback to summary
public void forceLocked(Object entity, Object nextVersion)
getDeletedStateback to summary
public Object[] getDeletedState()
getEntityKeyback to summary
public EntityKey getEntityKey()

Get the EntityKey for this entry.

Returns:EntityKey

the EntityKey

Exceptions
IllegalStateException:
if getId() is null
getEntityNameback to summary
public String getEntityName()
getExtraStateback to summary
public <T extends EntityEntryExtraState> T getExtraState(Class<T> extraStateType)
getIdback to summary
public Object getId()
getLoadedStateback to summary
public Object[] getLoadedState()
getLoadedValueback to summary
public Object getLoadedValue(String propertyName)
getLockModeback to summary
public LockMode getLockMode()
getPersisterback to summary
public EntityPersister getPersister()
getRowIdback to summary
public Object getRowId()
getStatusback to summary
public Status getStatus()
getVersionback to summary
public Object getVersion()
isBeingReplicatedback to summary
public boolean isBeingReplicated()
isExistsInDatabaseback to summary
public boolean isExistsInDatabase()
isModifiableEntityback to summary
public 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:boolean

true, if the entity is modifiable; false, otherwise,

isNullifiableback to summary
public boolean isNullifiable(boolean earlyInsert, SharedSessionContractImplementor session)
isReadOnlyback to summary
public boolean isReadOnly()
overwriteLoadedStateCollectionValueback to summary
public void overwriteLoadedStateCollectionValue(String propertyName, PersistentCollection<?> collection)
postDeleteback to summary
public void postDelete()

After actually deleting a row, record the fact that the instance no longer exists in the database.

postInsertback to summary
public void postInsert(Object version)
postInsertback to summary
public 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).

postUpdateback to summary
public 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:Object

The entity instance

updatedState:Object[]

The state calculated after the update (becomes the new loaded state.

nextVersion:Object

The new version.

requiresDirtyCheckback to summary
public boolean requiresDirtyCheck(Object entity)

Returns true 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:Object

The entity to test

Returns:boolean

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

serializeback to summary
public void serialize(ObjectOutputStream oos) throws IOException

Custom serialization routine used during serialization of a Session/PersistenceContext for increased performance.

Parameters
oos:ObjectOutputStream

The stream to which we should write the serial data.

Exceptions
IOException:
If a stream error occurs
setDeletedStateback to summary
public void setDeletedState(Object[] deletedState)
setLockModeback to summary
public void setLockMode(LockMode lockMode)
setReadOnlyback to summary
public void setReadOnly(boolean readOnly, Object entity)
setStatusback to summary
public void setStatus(Status status)
toStringback to summary
public String toString()
Annotations
@Override