@Override @SuppressWarnings("unchecked") public Object structure(Object item) { final CacheEntry entry = (CacheEntry) item; final String[] names = persister.getPropertyNames(); final Map map = new HashMap( names.length + 3, 1f ); map.put( SUBCLASS_KEY, entry.getSubclass() ); map.put( VERSION_KEY, entry.getVersion() ); for ( int i=0; i<names.length; i++ ) { map.put( names[i], entry.getDisassembledState()[i] ); } return map; } }
Serializable[] disassembledValues = cacheEntry.getDisassembledState(); final Object[] snapshot = entry.getLoadedState(); for ( int j = 0; j < lazyPropertyNames.length; j++ ) {
public Object structure(Object item) { CacheEntry entry = (CacheEntry) item; String[] names = persister.getPropertyNames(); Map map = new HashMap(names.length+2); map.put( "_subclass", entry.getSubclass() ); map.put( "_version", entry.getVersion() ); map.put( "_lazyPropertiesUnfetched", entry.areLazyPropertiesUnfetched() ); for ( int i=0; i<names.length; i++ ) { map.put( names[i], entry.getDisassembledState()[i] ); } return map; } }
@Override @SuppressWarnings("unchecked") public Object structure(Object item) { final CacheEntry entry = (CacheEntry) item; final String[] names = descriptor.getPropertyNames(); final Map map = new HashMap( names.length + 3, 1f ); map.put( SUBCLASS_KEY, entry.getSubclass() ); map.put( VERSION_KEY, entry.getVersion() ); for ( int i=0; i<names.length; i++ ) { map.put( names[i], entry.getDisassembledState()[i] ); } return map; } }
public Object structure(Object item) { CacheEntry entry = (CacheEntry) item; String[] names = persister.getPropertyNames(); Map map = new HashMap(names.length+2); map.put( "_subclass", entry.getSubclass() ); map.put( "_version", entry.getVersion() ); map.put( "_lazyPropertiesUnfetched", entry.areLazyPropertiesUnfetched() ); for ( int i=0; i<names.length; i++ ) { map.put( names[i], entry.getDisassembledState()[i] ); } return map; } }
private static void writeDisassembled(final ObjectDataOutput out, final CacheEntry object) throws IOException { Serializable[] disassembledState = object.getDisassembledState(); out.writeInt(disassembledState.length); for (Serializable state : disassembledState) { out.writeObject(state); } out.writeUTF(object.getSubclass()); out.writeObject(object.getVersion()); }
private static void writeDisassembled(final ObjectDataOutput out, final CacheEntry object) throws IOException { Serializable[] disassembledState = object.getDisassembledState(); out.writeInt(disassembledState.length); for (Serializable state : disassembledState) { out.writeObject(state); } out.writeUTF(object.getSubclass()); out.writeObject(object.getVersion()); }
private static void writeDisassembled(final ObjectDataOutput out, final CacheEntry object) throws IOException { Serializable[] disassembledState = object.getDisassembledState(); out.writeInt(disassembledState.length); for (Serializable state : disassembledState) { out.writeObject(state); } out.writeUTF(object.getSubclass()); out.writeObject(object.getVersion()); }
private Object initializeLazyPropertiesFromCache( final String fieldName, final Object entity, final SessionImplementor session, final EntityEntry entry, final CacheEntry cacheEntry ) { LOG.trace( "Initializing lazy properties from second-level cache" ); Object result = null; Serializable[] disassembledValues = cacheEntry.getDisassembledState(); final Object[] snapshot = entry.getLoadedState(); for ( int j = 0; j < lazyPropertyNames.length; j++ ) { final Object propValue = lazyPropertyTypes[j].assemble( disassembledValues[ lazyPropertyNumbers[j] ], session, entity ); if ( initializeLazyProperty( fieldName, entity, session, snapshot, j, propValue ) ) { result = propValue; } } LOG.trace( "Done initializing lazy properties" ); return result; }
private Object initializeLazyPropertiesFromCache( final String fieldName, final Object entity, final SessionImplementor session, final EntityEntry entry, final CacheEntry cacheEntry ) { LOG.trace( "Initializing lazy properties from second-level cache" ); Object result = null; Serializable[] disassembledValues = cacheEntry.getDisassembledState(); final Object[] snapshot = entry.getLoadedState(); for ( int j = 0; j < lazyPropertyNames.length; j++ ) { final Object propValue = lazyPropertyTypes[j].assemble( disassembledValues[ lazyPropertyNumbers[j] ], session, entity ); if ( initializeLazyProperty( fieldName, entity, session, snapshot, j, propValue ) ) { result = propValue; } } LOG.trace( "Done initializing lazy properties" ); return result; }
private static void writeDisassembled(final ObjectDataOutput out, final CacheEntry object) throws IOException { Serializable[] disassembledState = object.getDisassembledState(); out.writeInt(disassembledState.length); for (Serializable state : disassembledState) { out.writeObject(state); } out.writeUTF(object.getSubclass()); out.writeBoolean(object.areLazyPropertiesUnfetched()); out.writeObject(object.getVersion()); }
private static void writeDisassembled(final ObjectDataOutput out, final CacheEntry object) throws IOException { Serializable[] disassembledState = object.getDisassembledState(); out.writeInt(disassembledState.length); for (Serializable state : disassembledState) { out.writeObject(state); } out.writeUTF(object.getSubclass()); out.writeBoolean(object.areLazyPropertiesUnfetched()); out.writeObject(object.getVersion()); }
private static void writeDisassembled(ObjectDataOutput out, CacheEntry object) throws IOException { Serializable[] disassembledState = object.getDisassembledState(); out.writeInt(disassembledState.length); for (Serializable state : disassembledState) { out.writeObject(state); } out.writeUTF(object.getSubclass()); out.writeBoolean(object.areLazyPropertiesUnfetched()); out.writeObject(object.getVersion()); }
Serializable[] ser = entry.getDisassembledState(); assertTrue( ser[0].equals( "widget" ) ); assertTrue( ser[1].equals( "A bog standard item" ) );