}
// Try Level 2 since not in Level 1
if (omf.getBooleanProperty("org.jpox.cache.level2"))
{
Level2Cache l2Cache = omf.getLevel2Cache();
CachedPC cachedPC = l2Cache.get(id);
// Copy the cached object and connect to a StateManager, with the same object id
if (cachedPC != null)
{
sm = StateManagerFactory.newStateManagerForCachedPC(this,
cachedPC.getPersistableObject(), id, cachedPC.getLoadedFields());
if (cachedPC.getVersion() != null)
{
sm.setVersion(cachedPC.getVersion());
}
pc = sm.getObject();
if (JPOXLogger.CACHE.isDebugEnabled())
{
JPOXLogger.CACHE.debug(LOCALISER.msg("004006",
StringUtils.toJVMIDString(pc), id, "" + l2Cache.getSize()));
}
cache.put(id, sm); // Put into L1 cache for easy referencing
return pc;
}
else
{
if (JPOXLogger.CACHE.isDebugEnabled())
{
JPOXLogger.CACHE.debug(LOCALISER.msg("004005",
id, "" + l2Cache.getSize()));
}
}
}
return null;