*/
protected StateManagerImpl getStateManagerImpl(Object obj,
boolean assertThisContext) {
if (ImplHelper.isManageable(obj)) {
PersistenceCapable pc = ImplHelper.toPersistenceCapable(obj, _conf);
BrokerImpl pcBroker = (BrokerImpl)pc.pcGetGenericContext();
if (pcBroker == this || isFromWriteBehindCallback())
return (StateManagerImpl) pc.pcGetStateManager();
if (assertThisContext && pcBroker != null)
throw new UserException(_loc.get("not-managed",
Exceptions.toString(obj))).setFailedObject(obj);