if (isDetached(pc))
{
// Temporarily attach a StateManager to access the detached field information
ExecutionContext ec = ((JDOPersistenceManager)pm).getObjectManager();
StateManager sm = (StateManager) ObjectProviderFactory.newForDetached(ec, pc, getObjectId(pc), null);
pc.jdoReplaceStateManager((javax.jdo.spi.StateManager) sm);
sm.retrieveDetachState(sm);
int position = sm.getClassMetaData().getAbsolutePositionOfMember(memberName);
boolean[] dirtyFieldNumbers = sm.getDirtyFields();
pc.jdoReplaceStateManager(null);
return dirtyFieldNumbers[position];
}
else
{
ExecutionContext ec = ((JDOPersistenceManager)pc.jdoGetPersistenceManager()).getObjectManager();
ObjectProvider sm = ec.findObjectProvider(pc);
if (sm == null)
{
return null;
}
int position = sm.getClassMetaData().getAbsolutePositionOfMember(memberName);
boolean[] dirtyFieldNumbers = sm.getDirtyFields();
return dirtyFieldNumbers[position];
}
}