类 AbstractEntityEntry
- java.lang.Object
-
- org.hibernate.engine.internal.AbstractEntityEntry
-
- 所有已实现的接口:
Serializable,EntityEntry
- 直接已知子类:
ImmutableEntityEntry,MutableEntityEntry
public abstract class AbstractEntityEntry extends Object implements Serializable, EntityEntry
A base implementation of EntityEntry- 作者:
- Gavin King, Emmanuel Bernard
, Gunnar Morling, Sanne Grinovero - 另请参阅:
- 序列化表格
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 protected static classAbstractEntityEntry.BooleanStateRepresents a boolean flag stored within a number value, using one bit at a specified offset.protected static classAbstractEntityEntry.EnumState<E extends Enum<E>>Represents an enum value stored within a number value, using four bits starting at a specified offset.
-
字段概要
字段 修饰符和类型 字段 说明 protected EntityKeycachedEntityKeyprotected Serializableidprotected Object[]loadedStateprotected EntityEntryExtraStatenextprotected PersistenceContextpersistenceContextprotected EntityPersisterpersisterprotected ObjectrowIdprotected Objectversion
-
构造器概要
构造器 限定符 构造器 说明 protectedAbstractEntityEntry(SessionFactoryImplementor factory, String entityName, Serializable id, Status status, Status previousStatus, Object[] loadedState, Object[] deletedState, Object version, LockMode lockMode, boolean existsInDatabase, boolean isBeingReplicated, PersistenceContext persistenceContext)This for is used during custom deserialization handlingAbstractEntityEntry(Status status, Object[] loadedState, Object rowId, Serializable id, Object version, LockMode lockMode, boolean existsInDatabase, EntityPersister persister, boolean disableVersionIncrement, PersistenceContext persistenceContext)AbstractEntityEntry(Status status, Object[] loadedState, Object rowId, Serializable id, Object version, LockMode lockMode, boolean existsInDatabase, EntityPersister persister, EntityMode entityMode, String tenantId, boolean disableVersionIncrement, PersistenceContext persistenceContext)已过时。the tenantId and entityMode parameters where removed: this constructor accepts but ignores them.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidaddExtraState(EntityEntryExtraState extraState)voidforceLocked(Object entity, Object nextVersion)protected booleangetCompressedValue(AbstractEntityEntry.BooleanState state)Gets the current value of the given boolean flag.protected <E extends Enum<E>>
EgetCompressedValue(AbstractEntityEntry.EnumState<E> state)Gets the current value of the given enum property.Object[]getDeletedState()EntityKeygetEntityKey()Get the EntityKey based on this EntityEntry.StringgetEntityName()<T extends EntityEntryExtraState>
TgetExtraState(Class<T> extraStateType)SerializablegetId()Object[]getLoadedState()ObjectgetLoadedValue(String propertyName)LockModegetLockMode()PersistenceContextgetPersistenceContext()EntityPersistergetPersister()ObjectgetRowId()StatusgetStatus()ObjectgetVersion()booleanisBeingReplicated()booleanisExistsInDatabase()booleanisModifiableEntity()Can the entity be modified?booleanisNullifiable(boolean earlyInsert, SharedSessionContractImplementor session)booleanisReadOnly()voidoverwriteLoadedStateCollectionValue(String propertyName, PersistentCollection collection)voidpostDelete()After actually deleting a row, record the fact that the instance no longer exists in the databasevoidpostInsert(Object[] insertedState)After actually inserting a row, record the fact that the instance exists on the database (needed for identity-column key generation)voidpostUpdate(Object entity, Object[] updatedState, Object nextVersion)Handle updating the internal state of the entry after actually performing the database update.booleanrequiresDirtyCheck(Object entity)Not sure this is the best method name, but the general idea here is to returntrueif the entity can possibly be dirty.voidserialize(ObjectOutputStream oos)Custom serialization routine used during serialization of a Session/PersistenceContext for increased performance.protected voidsetCompressedValue(AbstractEntityEntry.BooleanState state, boolean value)Saves the value for the given boolean flag.protected <E extends Enum<E>>
voidsetCompressedValue(AbstractEntityEntry.EnumState<E> state, E value)Saves the value for the given enum property.voidsetDeletedState(Object[] deletedState)voidsetLockMode(LockMode lockMode)voidsetReadOnly(boolean readOnly, Object entity)voidsetStatus(Status status)StringtoString()
-
-
-
字段详细资料
-
id
protected final Serializable id
-
loadedState
protected Object[] loadedState
-
version
protected Object version
-
persister
protected final EntityPersister persister
-
cachedEntityKey
protected transient EntityKey cachedEntityKey
-
rowId
protected final transient Object rowId
-
persistenceContext
protected final transient PersistenceContext persistenceContext
-
next
protected EntityEntryExtraState next
-
-
构造器详细资料
-
AbstractEntityEntry
@Deprecated public AbstractEntityEntry(Status status, Object[] loadedState, Object rowId, Serializable id, Object version, LockMode lockMode, boolean existsInDatabase, EntityPersister persister, EntityMode entityMode, String tenantId, boolean disableVersionIncrement, PersistenceContext persistenceContext)
已过时。the tenantId and entityMode parameters where removed: this constructor accepts but ignores them. Use the other constructor!
-
AbstractEntityEntry
public AbstractEntityEntry(Status status, Object[] loadedState, Object rowId, Serializable id, Object version, LockMode lockMode, boolean existsInDatabase, EntityPersister persister, boolean disableVersionIncrement, PersistenceContext persistenceContext)
-
AbstractEntityEntry
protected AbstractEntityEntry(SessionFactoryImplementor factory, String entityName, Serializable id, Status status, Status previousStatus, Object[] loadedState, Object[] deletedState, Object version, LockMode lockMode, boolean existsInDatabase, boolean isBeingReplicated, PersistenceContext persistenceContext)
This for is used during custom deserialization handling
-
-
方法详细资料
-
getLockMode
public LockMode getLockMode()
- 指定者:
getLockMode在接口中EntityEntry
-
setLockMode
public void setLockMode(LockMode lockMode)
- 指定者:
setLockMode在接口中EntityEntry
-
getStatus
public Status getStatus()
- 指定者:
getStatus在接口中EntityEntry
-
setStatus
public void setStatus(Status status)
- 指定者:
setStatus在接口中EntityEntry
-
getId
public Serializable getId()
- 指定者:
getId在接口中EntityEntry
-
getLoadedState
public Object[] getLoadedState()
- 指定者:
getLoadedState在接口中EntityEntry
-
getDeletedState
public Object[] getDeletedState()
- 指定者:
getDeletedState在接口中EntityEntry
-
setDeletedState
public void setDeletedState(Object[] deletedState)
- 指定者:
setDeletedState在接口中EntityEntry
-
isExistsInDatabase
public boolean isExistsInDatabase()
- 指定者:
isExistsInDatabase在接口中EntityEntry
-
getVersion
public Object getVersion()
- 指定者:
getVersion在接口中EntityEntry
-
getPersister
public EntityPersister getPersister()
- 指定者:
getPersister在接口中EntityEntry
-
getEntityKey
public EntityKey getEntityKey()
从接口复制的说明:EntityEntryGet the EntityKey based on this EntityEntry.- 指定者:
getEntityKey在接口中EntityEntry- 返回:
- the EntityKey
-
getEntityName
public String getEntityName()
- 指定者:
getEntityName在接口中EntityEntry
-
isBeingReplicated
public boolean isBeingReplicated()
- 指定者:
isBeingReplicated在接口中EntityEntry
-
getRowId
public Object getRowId()
- 指定者:
getRowId在接口中EntityEntry
-
postUpdate
public void postUpdate(Object entity, Object[] updatedState, Object nextVersion)
从接口复制的说明:EntityEntryHandle updating the internal state of the entry after actually performing the database update. Specifically we update the snapshot information and escalate the lock mode- 指定者:
postUpdate在接口中EntityEntry- 参数:
entity- The entity instanceupdatedState- The state calculated after the update (becomes the newloaded state.nextVersion- The new version.
-
postDelete
public void postDelete()
从接口复制的说明:EntityEntryAfter actually deleting a row, record the fact that the instance no longer exists in the database- 指定者:
postDelete在接口中EntityEntry
-
postInsert
public void postInsert(Object[] insertedState)
从接口复制的说明:EntityEntryAfter actually inserting a row, record the fact that the instance exists on the database (needed for identity-column key generation)- 指定者:
postInsert在接口中EntityEntry
-
isNullifiable
public boolean isNullifiable(boolean earlyInsert, SharedSessionContractImplementor session)- 指定者:
isNullifiable在接口中EntityEntry
-
getLoadedValue
public Object getLoadedValue(String propertyName)
- 指定者:
getLoadedValue在接口中EntityEntry
-
overwriteLoadedStateCollectionValue
public void overwriteLoadedStateCollectionValue(String propertyName, PersistentCollection collection)
-
requiresDirtyCheck
public boolean requiresDirtyCheck(Object entity)
从接口复制的说明:EntityEntryNot sure this is the best method name, but the general idea here is to returntrueif the entity can possibly be dirty. This can only be the case if it is in a modifiable state (not read-only/deleted) and it either has mutable properties or field-interception is not telling us it is dirty. Clear as mud? :/ A name like canPossiblyBeDirty might be better- 指定者:
requiresDirtyCheck在接口中EntityEntry- 参数:
entity- The entity to test- 返回:
trueindicates that the entity could possibly be dirty and that dirty check should happen;falseindicates there is no way the entity can be dirty
-
isModifiableEntity
public boolean isModifiableEntity()
从接口复制的说明:EntityEntryCan 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
- 指定者:
isModifiableEntity在接口中EntityEntry- 返回:
- true, if the entity is modifiable; false, otherwise,
-
forceLocked
public void forceLocked(Object entity, Object nextVersion)
- 指定者:
forceLocked在接口中EntityEntry
-
isReadOnly
public boolean isReadOnly()
- 指定者:
isReadOnly在接口中EntityEntry
-
setReadOnly
public void setReadOnly(boolean readOnly, Object entity)- 指定者:
setReadOnly在接口中EntityEntry
-
toString
public String toString()
- 指定者:
toString在接口中EntityEntry- 覆盖:
toString在类中Object
-
serialize
public void serialize(ObjectOutputStream oos) throws IOException
从接口复制的说明:EntityEntryCustom serialization routine used during serialization of a Session/PersistenceContext for increased performance.- 指定者:
serialize在接口中EntityEntry- 参数:
oos- The stream to which we should write the serial data.- 抛出:
IOException- If a stream error occurs
-
addExtraState
public void addExtraState(EntityEntryExtraState extraState)
- 指定者:
addExtraState在接口中EntityEntry
-
getExtraState
public <T extends EntityEntryExtraState> T getExtraState(Class<T> extraStateType)
- 指定者:
getExtraState在接口中EntityEntry
-
getPersistenceContext
public PersistenceContext getPersistenceContext()
-
setCompressedValue
protected <E extends Enum<E>> void setCompressedValue(AbstractEntityEntry.EnumState<E> state, E value)
Saves the value for the given enum property.- 参数:
state- identifies the value to storevalue- the value to store; The caller must make sure that it matches the given identifier
-
getCompressedValue
protected <E extends Enum<E>> E getCompressedValue(AbstractEntityEntry.EnumState<E> state)
Gets the current value of the given enum property.- 参数:
state- identifies the value to store- 返回:
- the current value of the specified property
-
setCompressedValue
protected void setCompressedValue(AbstractEntityEntry.BooleanState state, boolean value)
Saves the value for the given boolean flag.- 参数:
state- identifies the value to storevalue- the value to store
-
getCompressedValue
protected boolean getCompressedValue(AbstractEntityEntry.BooleanState state)
Gets the current value of the given boolean flag.- 参数:
state- identifies the value to store- 返回:
- the current value of the specified flag
-
-