Package org.hibernate.engine.internal
Class EntityEntryImpl
java.lang.Object
org.hibernate.engine.internal.EntityEntryImpl
- All Implemented Interfaces:
Serializable
,EntityEntry
A base implementation of
EntityEntry
.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEntityEntryImpl
(Status status, Object[] loadedState, Object rowId, Object id, Object version, LockMode lockMode, boolean existsInDatabase, EntityPersister persister, boolean disableVersionIncrement, PersistenceContext persistenceContext) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addExtraState
(EntityEntryExtraState extraState) static EntityEntry
deserialize
(ObjectInputStream ois, PersistenceContext persistenceContext) Custom deserialization routine used during deserialization of aPersistenceContext
for increased performance.void
forceLocked
(Object entity, Object nextVersion) Object[]
Get theEntityKey
for this entry.<T extends EntityEntryExtraState>
TgetExtraState
(Class<T> extraStateType) getId()
Object[]
getLoadedValue
(String propertyName) @Nullable ImmutableBitSet
Has a bit set for every attribute position that is potentially lazy.getRowId()
boolean
boolean
boolean
Can the entity be modified?boolean
isNullifiable
(boolean earlyInsert, SharedSessionContractImplementor session) boolean
void
overwriteLoadedStateCollectionValue
(String propertyName, PersistentCollection<?> collection) void
After actually deleting a row, record the fact that the instance no longer exists in the database.void
postInsert
(Object version) 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).void
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) Returnstrue
if the entity can possibly be dirty.void
Custom serialization routine used during serialization of aSession
/PersistenceContext
for increased performance.void
setDeletedState
(Object[] deletedState) void
setLockMode
(LockMode lockMode) void
setMaybeLazySet
(@Nullable ImmutableBitSet maybeLazySet) void
setReadOnly
(boolean readOnly, Object entity) void
toString()
-
Constructor Details
-
EntityEntryImpl
public EntityEntryImpl(Status status, Object[] loadedState, Object rowId, Object id, Object version, LockMode lockMode, boolean existsInDatabase, EntityPersister persister, boolean disableVersionIncrement, PersistenceContext persistenceContext)
-
-
Method Details
-
getLockMode
- Specified by:
getLockMode
in interfaceEntityEntry
-
setLockMode
- Specified by:
setLockMode
in interfaceEntityEntry
-
getStatus
- Specified by:
getStatus
in interfaceEntityEntry
-
setStatus
- Specified by:
setStatus
in interfaceEntityEntry
-
getId
- Specified by:
getId
in interfaceEntityEntry
-
getLoadedState
- Specified by:
getLoadedState
in interfaceEntityEntry
-
getDeletedState
- Specified by:
getDeletedState
in interfaceEntityEntry
-
setDeletedState
- Specified by:
setDeletedState
in interfaceEntityEntry
-
isExistsInDatabase
public boolean isExistsInDatabase()- Specified by:
isExistsInDatabase
in interfaceEntityEntry
-
getVersion
- Specified by:
getVersion
in interfaceEntityEntry
-
postInsert
- Specified by:
postInsert
in interfaceEntityEntry
-
getPersister
- Specified by:
getPersister
in interfaceEntityEntry
-
getEntityKey
Description copied from interface:EntityEntry
Get theEntityKey
for this entry.- Specified by:
getEntityKey
in interfaceEntityEntry
- Returns:
- the
EntityKey
-
getEntityName
- Specified by:
getEntityName
in interfaceEntityEntry
-
isBeingReplicated
public boolean isBeingReplicated()- Specified by:
isBeingReplicated
in interfaceEntityEntry
-
getRowId
- Specified by:
getRowId
in interfaceEntityEntry
-
postUpdate
Description copied from interface:EntityEntry
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.- Specified by:
postUpdate
in interfaceEntityEntry
- Parameters:
entity
- The entity instanceupdatedState
- The state calculated after the update (becomes the newloaded state
.nextVersion
- The new version.
-
postLoad
- Specified by:
postLoad
in interfaceEntityEntry
-
postDelete
public void postDelete()Description copied from interface:EntityEntry
After actually deleting a row, record the fact that the instance no longer exists in the database.- Specified by:
postDelete
in interfaceEntityEntry
-
postInsert
Description copied from interface:EntityEntry
After actually inserting a row, record the fact that the instance exists in the database (needed for identity column key generation).- Specified by:
postInsert
in interfaceEntityEntry
-
getLoadedValue
- Specified by:
getLoadedValue
in interfaceEntityEntry
-
overwriteLoadedStateCollectionValue
public void overwriteLoadedStateCollectionValue(String propertyName, PersistentCollection<?> collection) - Specified by:
overwriteLoadedStateCollectionValue
in interfaceEntityEntry
-
requiresDirtyCheck
Description copied from interface:EntityEntry
Returnstrue
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.- Specified by:
requiresDirtyCheck
in interfaceEntityEntry
- Parameters:
entity
- The entity to test- 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
-
isModifiableEntity
public boolean isModifiableEntity()Description copied from interface:EntityEntry
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.
- Specified by:
isModifiableEntity
in interfaceEntityEntry
- Returns:
true
, if the entity is modifiable;false
, otherwise,
-
forceLocked
- Specified by:
forceLocked
in interfaceEntityEntry
-
isReadOnly
public boolean isReadOnly()- Specified by:
isReadOnly
in interfaceEntityEntry
-
setReadOnly
- Specified by:
setReadOnly
in interfaceEntityEntry
-
getMaybeLazySet
Description copied from interface:EntityEntry
Has a bit set for every attribute position that is potentially lazy. Whennull
, no knowledge is available and every attribute must be assumed potentially lazy.- Specified by:
getMaybeLazySet
in interfaceEntityEntry
-
setMaybeLazySet
- Specified by:
setMaybeLazySet
in interfaceEntityEntry
-
toString
- Specified by:
toString
in interfaceEntityEntry
- Overrides:
toString
in classObject
-
serialize
Description copied from interface:EntityEntry
Custom serialization routine used during serialization of aSession
/PersistenceContext
for increased performance.- Specified by:
serialize
in interfaceEntityEntry
- Parameters:
oos
- The stream to which we should write the serial data.- Throws:
IOException
- If a stream error occurs
-
deserialize
public static EntityEntry deserialize(ObjectInputStream ois, PersistenceContext persistenceContext) throws IOException, ClassNotFoundException Custom deserialization routine used during deserialization of aPersistenceContext
for increased performance.- Parameters:
ois
- The stream from which to read the entrypersistenceContext
- The context being deserialized- Returns:
- The deserialized
EntityEntry
- Throws:
IOException
- If a stream error occursClassNotFoundException
- If any of the classes declared in the stream cannot be found
-
addExtraState
- Specified by:
addExtraState
in interfaceEntityEntry
-
getExtraState
- Specified by:
getExtraState
in interfaceEntityEntry
-
getPersistenceContext
-