CacheEntrypublic final class CacheEntry extends Object implements SerializableA cached instance of a persistent class |
Fields Summary |
---|
private final Serializable[] | disassembledState | private final String | subclass | private final boolean | lazyPropertiesAreUnfetched | private final Object | version |
Constructors Summary |
---|
public CacheEntry(Object[] state, org.hibernate.persister.entity.EntityPersister persister, boolean unfetched, Object version, org.hibernate.engine.SessionImplementor session, Object owner)
//disassembled state gets put in a new array (we write to cache by value!)
this.disassembledState = TypeFactory.disassemble(
state,
persister.getPropertyTypes(),
persister.isLazyPropertiesCacheable() ?
null : persister.getPropertyLaziness(),
session,
owner
);
subclass = persister.getEntityName();
lazyPropertiesAreUnfetched = unfetched || !persister.isLazyPropertiesCacheable();
this.version = version;
| CacheEntry(Serializable[] state, String subclass, boolean unfetched, Object version)
this.disassembledState = state;
this.subclass = subclass;
this.lazyPropertiesAreUnfetched = unfetched;
this.version = version;
|
Methods Summary |
---|
public boolean | areLazyPropertiesUnfetched()
return lazyPropertiesAreUnfetched;
| public java.lang.Object[] | assemble(java.lang.Object instance, java.io.Serializable id, org.hibernate.persister.entity.EntityPersister persister, org.hibernate.Interceptor interceptor, org.hibernate.event.EventSource session)
if ( !persister.getEntityName().equals(subclass) ) {
throw new AssertionFailure("Tried to assemble a different subclass instance");
}
return assemble(disassembledState, instance, id, persister, interceptor, session);
| private static java.lang.Object[] | assemble(java.io.Serializable[] values, java.lang.Object result, java.io.Serializable id, org.hibernate.persister.entity.EntityPersister persister, org.hibernate.Interceptor interceptor, org.hibernate.event.EventSource session)
//assembled state gets put in a new array (we read from cache by value!)
Object[] assembledProps = TypeFactory.assemble(
values,
persister.getPropertyTypes(),
session, result
);
//persister.setIdentifier(result, id); //before calling interceptor, for consistency with normal load
//TODO: reuse the PreLoadEvent
PreLoadEvent preLoadEvent = new PreLoadEvent( session )
.setEntity(result)
.setState(assembledProps)
.setId(id)
.setPersister(persister);
PreLoadEventListener[] listeners = session.getListeners().getPreLoadEventListeners();
for ( int i = 0; i < listeners.length; i++ ) {
listeners[i].onPreLoad(preLoadEvent);
}
persister.setPropertyValues(
result,
assembledProps,
session.getEntityMode()
);
return assembledProps;
| public java.io.Serializable[] | getDisassembledState()
// 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 a EntityEntry based on this
// state for return.
return disassembledState;
| public java.lang.String | getSubclass()
return subclass;
| public java.lang.Object | getVersion()
return version;
| public java.lang.String | toString()
return "CacheEntry(" + subclass + ')" +
ArrayHelper.toString(disassembledState);
|
|