Top Description Fields Constructors Methods
org.hibernate.engine

public final Class EntityEntry

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.Serializable, .ObjectOutputStream, .IOException, .ObjectInputStream, org.hibernate.EntityMode, .HibernateException, .LockMode, org.hibernate.intercept.FieldInterceptionHelper, org.hibernate.persister.entity.EntityPersister, .UniqueKeyLoadable, org.hibernate.pretty.MessageHelper

We need an entry to tell us all about the current state of an object with respect to its persistent state
Author
Gavin King

Field Summary

Modifier and TypeField and Description
private transient EntityKey
private Object[]
private final EntityMode
private final String
private boolean
private final Serializable
private boolean
private Object[]
private boolean
private LockMode
private transient EntityPersister
private Status
private final transient Object
private Status
private Object

Constructor Summary

AccessConstructor and Description
pack-priv
EntityEntry(final Status status, final Object[] loadedState, final Object rowId, final Serializable id, final Object version, final LockMode lockMode, final boolean existsInDatabase, final EntityPersister persister, final EntityMode entityMode, final boolean disableVersionIncrement, final boolean lazyPropertiesAreUnfetched)

private
EntityEntry(final SessionFactoryImplementor factory, final String entityName, final Serializable id, final EntityMode entityMode, final Status status, final Status previousStatus, final Object[] loadedState, final Object[] deletedState, final Object version, final LockMode lockMode, final boolean existsInDatabase, final boolean isBeingReplicated, final boolean loadedWithLazyPropertiesUnfetched)

Method Summary

Modifier and TypeMethod and Description
pack-priv static EntityEntry

Returns:

The deserialized EntityEntry
deserialize
(ObjectInputStream
The stream from which to read the entry.
ois
,
SessionImplementor
The session being deserialized.
session
)

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

public void
forceLocked(Object entity, Object nextVersion)

public Object[]
public EntityKey

Returns:

the EntityKey
getEntityKey
()

Get the EntityKey based on this EntityEntry.

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

public LockMode
public EntityPersister
public Object
public Status
public Object
public boolean
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, SessionImplementor session)

public boolean
public void
postDelete()

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

public void
postInsert()

After actually inserting a row, record the fact that the instance exists on 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
pack-priv 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
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

cachedEntityKeyback to summary
private transient EntityKey cachedEntityKey
deletedStateback to summary
private Object[] deletedState
entityModeback to summary
private final EntityMode entityMode
entityNameback to summary
private final String entityName
existsInDatabaseback to summary
private boolean existsInDatabase
idback to summary
private final Serializable id
isBeingReplicatedback to summary
private boolean isBeingReplicated
loadedStateback to summary
private Object[] loadedState
loadedWithLazyPropertiesUnfetchedback to summary
private boolean loadedWithLazyPropertiesUnfetched
lockModeback to summary
private LockMode lockMode
persisterback to summary
private transient EntityPersister persister
previousStatusback to summary
private Status previousStatus
rowIdback to summary
private final transient Object rowId
statusback to summary
private Status status
versionback to summary
private Object version

Constructor Detail

EntityEntryback to summary
pack-priv EntityEntry(final Status status, final Object[] loadedState, final Object rowId, final Serializable id, final Object version, final LockMode lockMode, final boolean existsInDatabase, final EntityPersister persister, final EntityMode entityMode, final boolean disableVersionIncrement, final boolean lazyPropertiesAreUnfetched)
EntityEntryback to summary
private EntityEntry(final SessionFactoryImplementor factory, final String entityName, final Serializable id, final EntityMode entityMode, final Status status, final Status previousStatus, final Object[] loadedState, final Object[] deletedState, final Object version, final LockMode lockMode, final boolean existsInDatabase, final boolean isBeingReplicated, final boolean loadedWithLazyPropertiesUnfetched)

Method Detail

deserializeback to summary
pack-priv static EntityEntry deserialize(ObjectInputStream ois, SessionImplementor session) throws IOException, ClassNotFoundException

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

Parameters
ois:ObjectInputStream

The stream from which to read the entry.

session:SessionImplementor

The session being deserialized.

Returns:EntityEntry

The deserialized EntityEntry

Exceptions
IOException:
If a stream error occurs
ClassNotFoundException:
If any of the classes declared in the stream cannot be found
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 based on this EntityEntry.

Returns:EntityKey

the EntityKey

Exceptions
IllegalStateException:
if getId() is null
getEntityNameback to summary
public String getEntityName()
getIdback to summary
public Serializable 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()
isLoadedWithLazyPropertiesUnfetchedback to summary
public boolean isLoadedWithLazyPropertiesUnfetched()
isModifiableEntityback to summary
public boolean isModifiableEntity()

Can the entity be modified? The entity is modifiable if all of the following are true:

  • the entity class is mutable
  • the entity is not read-only
  • 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, SessionImplementor session)
isReadOnlyback to summary
public boolean isReadOnly()
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()

After actually inserting a row, record the fact that the instance exists on 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)
serializeback to summary
pack-priv 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()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.