public abstract class AbstractEntityEntry extends Object implements Serializable, EntityEntry
| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractEntityEntry.BooleanState
Represents a boolean flag stored within a number value, using one bit at a specified offset.
|
protected static class |
AbstractEntityEntry.EnumState<E extends Enum<E>>
Represents an enum value stored within a number value, using four bits starting at a specified offset.
|
| Modifier and Type | Field and Description |
|---|---|
protected EntityKey |
cachedEntityKey |
protected Serializable |
id |
protected Object[] |
loadedState |
protected EntityEntryExtraState |
next |
protected PersistenceContext |
persistenceContext |
protected EntityPersister |
persister |
protected Object |
rowId |
protected Object |
version |
| Modifier | Constructor and Description |
|---|---|
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
|
|
AbstractEntityEntry(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)
Deprecated.
the tenantId and entityMode parameters where removed: this constructor accepts but ignores them.
Use the other constructor!
|
| Modifier and Type | Method and Description |
|---|---|
void |
addExtraState(EntityEntryExtraState extraState) |
void |
forceLocked(Object entity,
Object nextVersion) |
protected boolean |
getCompressedValue(AbstractEntityEntry.BooleanState state)
Gets the current value of the given boolean flag.
|
protected <E extends Enum<E>> |
getCompressedValue(AbstractEntityEntry.EnumState<E> state)
Gets the current value of the given enum property.
|
Object[] |
getDeletedState() |
EntityKey |
getEntityKey()
Get the EntityKey based on this EntityEntry.
|
String |
getEntityName() |
<T extends EntityEntryExtraState> |
getExtraState(Class<T> extraStateType) |
Serializable |
getId() |
Object[] |
getLoadedState() |
Object |
getLoadedValue(String propertyName) |
LockMode |
getLockMode() |
PersistenceContext |
getPersistenceContext() |
EntityPersister |
getPersister() |
Object |
getRowId() |
Status |
getStatus() |
Object |
getVersion() |
boolean |
isBeingReplicated() |
boolean |
isExistsInDatabase() |
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
|
boolean |
isNullifiable(boolean earlyInsert,
SessionImplementor 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[] insertedState)
After actually inserting a row, record the fact that the instance exists on 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)
Not sure this is the best method name, but the general idea here is to return
true if the entity can
possibly be dirty. |
void |
serialize(ObjectOutputStream oos)
Custom serialization routine used during serialization of a
Session/PersistenceContext for increased performance.
|
protected void |
setCompressedValue(AbstractEntityEntry.BooleanState state,
boolean value)
Saves the value for the given boolean flag.
|
protected <E extends Enum<E>> |
setCompressedValue(AbstractEntityEntry.EnumState<E> state,
E value)
Saves the value for the given enum property.
|
void |
setDeletedState(Object[] deletedState) |
void |
setLockMode(LockMode lockMode) |
void |
setReadOnly(boolean readOnly,
Object entity) |
void |
setStatus(Status status) |
String |
toString() |
protected final Serializable id
protected Object[] loadedState
protected Object version
protected final EntityPersister persister
protected transient EntityKey cachedEntityKey
protected final transient Object rowId
protected final transient PersistenceContext persistenceContext
protected EntityEntryExtraState next
@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)
public AbstractEntityEntry(Status status, Object[] loadedState, Object rowId, Serializable id, Object version, LockMode lockMode, boolean existsInDatabase, EntityPersister persister, boolean disableVersionIncrement, PersistenceContext persistenceContext)
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)
public LockMode getLockMode()
getLockMode in interface EntityEntrypublic void setLockMode(LockMode lockMode)
setLockMode in interface EntityEntrypublic Status getStatus()
getStatus in interface EntityEntrypublic void setStatus(Status status)
setStatus in interface EntityEntrypublic Serializable getId()
getId in interface EntityEntrypublic Object[] getLoadedState()
getLoadedState in interface EntityEntrypublic Object[] getDeletedState()
getDeletedState in interface EntityEntrypublic void setDeletedState(Object[] deletedState)
setDeletedState in interface EntityEntrypublic boolean isExistsInDatabase()
isExistsInDatabase in interface EntityEntrypublic Object getVersion()
getVersion in interface EntityEntrypublic EntityPersister getPersister()
getPersister in interface EntityEntrypublic EntityKey getEntityKey()
EntityEntrygetEntityKey in interface EntityEntrypublic String getEntityName()
getEntityName in interface EntityEntrypublic boolean isBeingReplicated()
isBeingReplicated in interface EntityEntrypublic Object getRowId()
getRowId in interface EntityEntrypublic void postUpdate(Object entity, Object[] updatedState, Object nextVersion)
EntityEntrypostUpdate in interface EntityEntryentity - The entity instanceupdatedState - The state calculated after the update (becomes the
new loaded state.nextVersion - The new version.public void postDelete()
EntityEntrypostDelete in interface EntityEntrypublic void postInsert(Object[] insertedState)
EntityEntrypostInsert in interface EntityEntrypublic boolean isNullifiable(boolean earlyInsert,
SessionImplementor session)
isNullifiable in interface EntityEntrypublic Object getLoadedValue(String propertyName)
getLoadedValue in interface EntityEntrypublic void overwriteLoadedStateCollectionValue(String propertyName, PersistentCollection collection)
overwriteLoadedStateCollectionValue in interface EntityEntrypublic boolean requiresDirtyCheck(Object entity)
EntityEntrytrue if 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 betterrequiresDirtyCheck in interface EntityEntryentity - The entity to testtrue indicates that the entity could possibly be dirty and that dirty check
should happen; false indicates there is no way the entity can be dirtypublic boolean isModifiableEntity()
EntityEntryisModifiableEntity in interface EntityEntrypublic void forceLocked(Object entity, Object nextVersion)
forceLocked in interface EntityEntrypublic boolean isReadOnly()
isReadOnly in interface EntityEntrypublic void setReadOnly(boolean readOnly,
Object entity)
setReadOnly in interface EntityEntrypublic String toString()
toString in interface EntityEntrytoString in class Objectpublic void serialize(ObjectOutputStream oos) throws IOException
EntityEntryserialize in interface EntityEntryoos - The stream to which we should write the serial data.IOException - If a stream error occurspublic void addExtraState(EntityEntryExtraState extraState)
addExtraState in interface EntityEntrypublic <T extends EntityEntryExtraState> T getExtraState(Class<T> extraStateType)
getExtraState in interface EntityEntrypublic PersistenceContext getPersistenceContext()
protected <E extends Enum<E>> void setCompressedValue(AbstractEntityEntry.EnumState<E> state, E value)
state - identifies the value to storevalue - the value to store; The caller must make sure that it matches
the given identifierprotected <E extends Enum<E>> E getCompressedValue(AbstractEntityEntry.EnumState<E> state)
state - identifies the value to storeprotected void setCompressedValue(AbstractEntityEntry.BooleanState state, boolean value)
state - identifies the value to storevalue - the value to storeprotected boolean getCompressedValue(AbstractEntityEntry.BooleanState state)
state - identifies the value to storeCopyright © 2017 JBoss by Red Hat. All rights reserved.