if (api.isDetached(pc))
{
// Detached, so migrate to attached
if (cache != null)
{
StateManager l1CachedSM = (StateManager)cache.get(id);
if (l1CachedSM != null && l1CachedSM.getObject() != pc)
{
// attached object with the same id already present in the L1 cache so cannot attach in-situ
throw new NucleusUserException(LOCALISER.msg("010017",
StringUtils.toJVMIDString(pc)));
}
}
if (NucleusLogger.PERSISTENCE.isDebugEnabled())
{
NucleusLogger.PERSISTENCE.debug(LOCALISER.msg("010016", StringUtils.toJVMIDString(pc)));
}
StateManager sm =
(StateManager) ObjectProviderFactory.newForDetached(this, pc, id, api.getVersionForObject(pc));
sm.attach(sco);
}
else
{
// Not detached so can't attach it. Just return
return;