/** * Accessor for the persistence manager for this object. * The returned object will be a JPA EntityManager or null if not managed. * @param obj The object * @return The persistence manager */ public Object getPersistenceManager(Object obj) { // TODO Replace this with a non-JDO class if (obj instanceof PersistenceCapable) { return ((PersistenceCapable)obj).jdoGetPersistenceManager(); } return null; }
/** * Accessor for the persistence manager for this object. * The returned object will be a JPA EntityManager or null if not managed. * @param obj The object * @return The persistence manager */ public Object getPersistenceManager(Object obj) { // TODO Replace this with a non-JDO class if (obj instanceof PersistenceCapable) { return ((PersistenceCapable)obj).jdoGetPersistenceManager(); } return null; }
/** Return the associated <code>PersistenceManager</code> if there is one. * Transactional and persistent instances return the associated * <code>PersistenceManager</code>. * * <P>Transient non-transactional instances and instances of classes * that do not implement <code>PersistenceCapable</code> return * <code>null</code>. * @see PersistenceCapable#jdoGetPersistenceManager() * @param pc the <code>PersistenceCapable</code> instance. * @return the <code>PersistenceManager</code> associated with the parameter * instance. */ public static PersistenceManager getPersistenceManager(Object pc) { if (pc instanceof PersistenceCapable) { return ((PersistenceCapable)pc).jdoGetPersistenceManager(); } else { return (PersistenceManager) implHelper.nonBinaryCompatibleGet(pc, getPersistenceManager); } }
/** Return the associated <code>PersistenceManager</code> if there is one. * Transactional and persistent instances return the associated * <code>PersistenceManager</code>. * * <P>Transient non-transactional instances and instances of classes * that do not implement <code>PersistenceCapable</code> return * <code>null</code>. * @see PersistenceCapable#jdoGetPersistenceManager() * @param pc the <code>PersistenceCapable</code> instance. * @return the <code>PersistenceManager</code> associated with the parameter * instance. */ public static PersistenceManager getPersistenceManager(Object pc) { if (pc instanceof PersistenceCapable) { return ((PersistenceCapable)pc).jdoGetPersistenceManager(); } else { return (PersistenceManager) implHelper.nonBinaryCompatibleGet(pc, getPersistenceManager); } }
if (pc.jdoGetPersistenceManager() != null && pc.jdoGetPersistenceManager() != pm) if (pc.jdoGetPersistenceManager() != null && pc.jdoGetPersistenceManager() != pm)
/** * Method to add an object to the cache under its id * @param oid The identity * @param pc The cacheable object */ public CachedPC put(Object oid, CachedPC pc) { if (oid == null || pc == null) { return null; } // Check if the object is disconnected from its StateManager/PM if (pc.getPersistenceCapable().jdoGetPersistenceManager() != null) { return null; } cache.put(toElement(oid, pc)); return pc; }
if (pc.getPersistenceCapable().jdoGetPersistenceManager() != null)
((PersistenceManager)pc.jdoGetPersistenceManager()).findStateManager(pc).loadFieldsInFetchPlan(state); ((PersistenceManager)pc.jdoGetPersistenceManager()).findStateManager(pc).loadFieldsInFetchPlan(state);
/** * Method to add an object to the cache under its id * @param oid The identity * @param pc The cacheable object */ public CachedPC put(Object oid, CachedPC pc) { if (oid == null || pc == null) { return null; } // Check if the object is disconnected from its StateManager/PM if (pc.getPersistenceCapable().jdoGetPersistenceManager() != null) { return null; } getCacheForId(oid).put(toElement(oid, pc)); return pc; }
if (pc.jdoIsPersistent()) ((PersistenceManager)pc.jdoGetPersistenceManager()).internalMakeTransient(pc, state); if (pc.jdoIsPersistent()) ((PersistenceManager)pc.jdoGetPersistenceManager()).internalMakeTransient(pc, state);
if (listener.forClass(pc.getClass()) && listener.getListener() instanceof StoreLifecycleListener) PersistenceManager jdoPM = ((PersistenceCapable)pc).jdoGetPersistenceManager(); String[] fieldNames = null; if (jdoPM instanceof org.jpox.PersistenceManager)
(PersistenceCapable)((PersistenceManager)pc.jdoGetPersistenceManager()).detachCopyInternal(pc, state); arrDetached[j] = pcDetached; ((PersistenceManager)pc.jdoGetPersistenceManager()).detachInternal(pc, state); arrDetached[j] = pc; return ((PersistenceManager)pc.jdoGetPersistenceManager()).detachCopyInternal(pc, state); ((PersistenceManager)pc.jdoGetPersistenceManager()).detachInternal(value, state); return value;
private void invokeCallback(final Object pc, final Class callbackClass) final ObjectManager om = ((JDOPersistenceManager) ((PersistenceCapable) pc).jdoGetPersistenceManager()).getObjectManager(); final ClassLoaderResolver clr = om.getClassLoaderResolver();
/** * Method to extract the value of the PersistenceCapable from a ResultSet. * @param pm The Persistence Manager * @param resultSet The ResultSet * @param exprIndex The parameter positions in the result set to use. * @param ownerSM The owning object * @param fieldNumber Absolute number of field in owner object * @return The (deserialised) PersistenceCapable object */ public Object getObject(PersistenceManager pm, Object resultSet, int[] exprIndex, StateManager ownerSM, int fieldNumber) { Object obj = getDataStoreMapping(0).getObject(resultSet, exprIndex[0]); if (obj != null && obj instanceof PersistenceCapable) { // Assign a StateManager to the serialised object if none present PersistenceCapable pc = (PersistenceCapable)obj; StateManager embSM = pm.findStateManager(pc); if (embSM == null || pc.jdoGetPersistenceManager() == null) { embSM = StateManagerFactory.newStateManager(pc, pm, false); embSM.addEmbeddedOwner(ownerSM, fieldNumber); // Feed dirty flags to the owning object } } return obj; } }
/** * Method to extract the value of the PersistenceCapable from a ResultSet. * @param pm The Persistence Manager * @param resultSet The ResultSet * @param exprIndex The parameter positions in the result set to use. * @param ownerSM The owning object * @param fieldNumber Absolute number of field in owner object * @return The (deserialised) PersistenceCapable object */ public Object getObject(PersistenceManager pm, Object resultSet, int[] exprIndex, StateManager ownerSM, int fieldNumber) { Object obj = getDataStoreMapping(0).getObject(resultSet, exprIndex[0]); if (obj != null) { // Assign a StateManager to the serialised object if none present PersistenceCapable pc = (PersistenceCapable)obj; StateManager embSM = pm.findStateManager(pc); if (embSM == null || pc.jdoGetPersistenceManager() == null) { embSM = StateManagerFactory.newStateManager(pc, pm, false); embSM.addEmbeddedOwner(ownerSM, fieldNumber); // Feed dirty flags to the owning object } } return obj; } }
PersistenceManager pm = (PersistenceManager) pc.jdoGetPersistenceManager(); if (pm != null && this.getPMHandle() != pm.getPMHandle())
if (sm == null || pc.jdoGetPersistenceManager() == null)
AbstractClassMetaData embCmd = pm.getMetaDataManager().getMetaDataForClass(pc.getClass().getName(), pm.getClassLoaderResolver()); StateManager embSM = pm.findStateManager(pc); if (embSM == null || pc.jdoGetPersistenceManager() == null)
if (embSM == null || pc.jdoGetPersistenceManager() == null)
if (embSM == null || pc.jdoGetPersistenceManager() == null)