Package org.hibernate.cache.spi.entry
Class StandardCacheEntryImpl
- java.lang.Object
-
- org.hibernate.cache.spi.entry.StandardCacheEntryImpl
-
- All Implemented Interfaces:
Serializable
,CacheEntry
public class StandardCacheEntryImpl extends Object implements CacheEntry
Standard representation of entity cached data using the "disassembled state".- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description StandardCacheEntryImpl(Object[] state, EntityPersister persister, Object version, SharedSessionContractImplementor session, Object owner)
Constructs a StandardCacheEntryImpl
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object[]
assemble(Object instance, Object id, EntityPersister persister, Interceptor interceptor, EventSource session)
Assemble the previously disassembled state represented by this entry into the given entity instance.Serializable[]
getDisassembledState()
Get the underlying disassembled state todo : this was added to support initializing an entity's EntityEntry snapshot during reattach; this should be refactored to instead expose a method to assemble an EntityEntry based on this state for return.String
getSubclass()
Hibernate stores all entries pertaining to a given entity hierarchy in a single region.Object
getVersion()
Retrieves the version (optimistic locking) associated with this cache entry.boolean
isDeepCopyNeeded()
After assembly, is a copy of the array needed?boolean
isReferenceEntry()
Does this entry represent a direct entity reference (rather than disassembled state)?String
toString()
-
-
-
Constructor Detail
-
StandardCacheEntryImpl
public StandardCacheEntryImpl(Object[] state, EntityPersister persister, Object version, SharedSessionContractImplementor session, Object owner) throws HibernateException
Constructs a StandardCacheEntryImpl- Parameters:
state
- The extracted statepersister
- The entity persisterversion
- The current version (if versioned)session
- The originating sessionowner
- The owner- Throws:
HibernateException
- Generally indicates a problem performing the dis-assembly.
-
-
Method Detail
-
isReferenceEntry
public boolean isReferenceEntry()
Description copied from interface:CacheEntry
Does this entry represent a direct entity reference (rather than disassembled state)?- Specified by:
isReferenceEntry
in interfaceCacheEntry
- Returns:
- true/false
-
getDisassembledState
public Serializable[] getDisassembledState()
Description copied from interface:CacheEntry
Get the underlying disassembled state todo : this was added to support initializing an entity's EntityEntry snapshot during reattach; this should be refactored to instead expose a method to assemble an EntityEntry based on this state for return.- Specified by:
getDisassembledState
in interfaceCacheEntry
- Returns:
- The disassembled state
-
getSubclass
public String getSubclass()
Description copied from interface:CacheEntry
Hibernate stores all entries pertaining to a given entity hierarchy in a single region. This attribute tells us the specific entity type represented by the cached data.- Specified by:
getSubclass
in interfaceCacheEntry
- Returns:
- The entry's exact entity type.
-
getVersion
public Object getVersion()
Description copied from interface:CacheEntry
Retrieves the version (optimistic locking) associated with this cache entry.- Specified by:
getVersion
in interfaceCacheEntry
- Returns:
- The version of the entity represented by this entry
-
isDeepCopyNeeded
public boolean isDeepCopyNeeded()
After assembly, is a copy of the array needed?- Returns:
- true/false
-
assemble
public Object[] assemble(Object instance, Object id, EntityPersister persister, Interceptor interceptor, EventSource session) throws HibernateException
Assemble the previously disassembled state represented by this entry into the given entity instance. Additionally manages the PreLoadEvent callbacks.- Parameters:
instance
- The entity instanceid
- The entity identifierpersister
- The entity persisterinterceptor
- (currently unused)session
- The session- Returns:
- The assembled state
- Throws:
HibernateException
- Indicates a problem performing assembly or calling the PreLoadEventListeners.- See Also:
Type.assemble(java.io.Serializable, org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)
,Type.disassemble(java.lang.Object, org.hibernate.engine.spi.SessionFactoryImplementor)
-
-