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,
SharedSessionContractImplementor 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 EntityEntry
public void setLockMode(LockMode lockMode)
setLockMode
in interface EntityEntry
public Status getStatus()
getStatus
in interface EntityEntry
public void setStatus(Status status)
setStatus
in interface EntityEntry
public Serializable getId()
getId
in interface EntityEntry
public Object[] getLoadedState()
getLoadedState
in interface EntityEntry
public Object[] getDeletedState()
getDeletedState
in interface EntityEntry
public void setDeletedState(Object[] deletedState)
setDeletedState
in interface EntityEntry
public boolean isExistsInDatabase()
isExistsInDatabase
in interface EntityEntry
public Object getVersion()
getVersion
in interface EntityEntry
public EntityPersister getPersister()
getPersister
in interface EntityEntry
public EntityKey getEntityKey()
EntityEntry
getEntityKey
in interface EntityEntry
public String getEntityName()
getEntityName
in interface EntityEntry
public boolean isBeingReplicated()
isBeingReplicated
in interface EntityEntry
public Object getRowId()
getRowId
in interface EntityEntry
public void postUpdate(Object entity, Object[] updatedState, Object nextVersion)
EntityEntry
postUpdate
in interface EntityEntry
entity
- The entity instanceupdatedState
- The state calculated after the update (becomes the
new loaded state
.nextVersion
- The new version.public void postDelete()
EntityEntry
postDelete
in interface EntityEntry
public void postInsert(Object[] insertedState)
EntityEntry
postInsert
in interface EntityEntry
public boolean isNullifiable(boolean earlyInsert, SharedSessionContractImplementor session)
isNullifiable
in interface EntityEntry
public Object getLoadedValue(String propertyName)
getLoadedValue
in interface EntityEntry
public void overwriteLoadedStateCollectionValue(String propertyName, PersistentCollection collection)
overwriteLoadedStateCollectionValue
in interface EntityEntry
public boolean requiresDirtyCheck(Object entity)
EntityEntry
true
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 EntityEntry
entity
- 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()
EntityEntry
isModifiableEntity
in interface EntityEntry
public void forceLocked(Object entity, Object nextVersion)
forceLocked
in interface EntityEntry
public boolean isReadOnly()
isReadOnly
in interface EntityEntry
public void setReadOnly(boolean readOnly, Object entity)
setReadOnly
in interface EntityEntry
public String toString()
toString
in interface EntityEntry
toString
in class Object
public void serialize(ObjectOutputStream oos) throws IOException
EntityEntry
serialize
in interface EntityEntry
oos
- The stream to which we should write the serial data.IOException
- If a stream error occurspublic void addExtraState(EntityEntryExtraState extraState)
addExtraState
in interface EntityEntry
public <T extends EntityEntryExtraState> T getExtraState(Class<T> extraStateType)
getExtraState
in interface EntityEntry
public 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 © 2019 JBoss by Red Hat. All rights reserved.