/** * Convenience accessor for whether the object is persistent. * @param obj The object * @return Whether it is persistent */ public static boolean isPersistent(Object obj) { // TODO Change this to org.datanucleus.jpa.Persistable when we swap over if (obj instanceof PersistenceCapable) { return ((PersistenceCapable)obj).jdoIsPersistent(); } return false; }
/** * Convenience accessor for whether the object is persistent. * @param obj The object * @return Whether it is persistent */ public static boolean isPersistent(Object obj) { // TODO Change this to org.datanucleus.jpa.Persistable when we swap over if (obj instanceof PersistenceCapable) { return ((PersistenceCapable)obj).jdoIsPersistent(); } return false; }
/** Tests whether the parameter instance is persistent. * * Instances that represent persistent objects in the data store * return <code>true</code>. * *<P>Transient instances and instances of classes that do not implement * <code>PersistenceCapable</code> return <code>false</code>. *<P> * @see PersistenceManager#makePersistent(Object pc) * @see PersistenceCapable#jdoIsPersistent() * @param pc the <code>PersistenceCapable</code> instance. * @return <code>true</code> if the parameter instance is persistent. */ public static boolean isPersistent(Object pc) { if (pc instanceof PersistenceCapable) { return ((PersistenceCapable)pc).jdoIsPersistent(); } else { return implHelper.nonBinaryCompatibleIs(pc, isPersistent); } }
/** Tests whether the parameter instance is persistent. * * Instances that represent persistent objects in the data store * return <code>true</code>. * *<P>Transient instances and instances of classes that do not implement * <code>PersistenceCapable</code> return <code>false</code>. *<P> * @see PersistenceManager#makePersistent(Object pc) * @see PersistenceCapable#jdoIsPersistent() * @param pc the <code>PersistenceCapable</code> instance. * @return <code>true</code> if the parameter instance is persistent. */ public static boolean isPersistent(Object pc) { if (pc instanceof PersistenceCapable) { return ((PersistenceCapable)pc).jdoIsPersistent(); } else { return implHelper.nonBinaryCompatibleIs(pc, isPersistent); } }
/** * Accessor for an object id given the object. * @param pc The object * @return The Object id */ public Object getObjectId(Object pc) { assertIsOpen(); if (pc != null && pc instanceof PersistenceCapable) { PersistenceCapable p = (PersistenceCapable) pc; if (p.jdoIsPersistent() || p.jdoIsDetached()) { return p.jdoGetObjectId(); } } return null; }
if (pc.jdoIsPersistent()) if (pc.jdoIsPersistent())
if( sms[i] != null && sms[i].getObject() != null && (sms[i].getObject().jdoIsPersistent() || sms[i].getObject().jdoIsTransactional()))
/** * Method to make nontransactional an object. * @param pc The object */ public synchronized void makeNontransactional(Object pc) { assertIsOpen(); if (pc == null) { // JDO2 [12.6.0] Null means do nothing return; } // for non transactional read, tx might be not active // TODO add verification if is non transactional read = true if (tx.isActive()) { assertActiveTransaction(); } // if !transactional and !persistent if (!((PersistenceCapable) pc).jdoIsTransactional() && !((PersistenceCapable) pc).jdoIsPersistent()) { throw new JDOUserException(LOCALISER.msg("PM.MakeNontransactionalOnNontransactionalTransientInstances")); } // if !transactional and persistent, do nothing if (!((PersistenceCapable) pc).jdoIsTransactional() && ((PersistenceCapable) pc).jdoIsPersistent()) { return; } internalMakeNontransactional(pc); }
assertNotDetached(obj); PersistenceCapable pc = (PersistenceCapable) obj; if (pc.jdoIsPersistent())
/** * Method to make nontransactional an object (internally). * @param obj The object */ private void internalMakeNontransactional(Object obj) { if (obj == null) { return; } try { clr.setPrimary(obj.getClass().getClassLoader()); assertPersistenceCapable(obj); PersistenceCapable pc = (PersistenceCapable) obj; if (!pc.jdoIsPersistent() && pc.jdoIsTransactional() && pc.jdoIsDirty()) { throw new JDOUserException(LOCALISER.msg("PM.MakeNonTransactionalOnTransientDirtyInstances")); } StateManager sm = findStateManager(pc); sm.makeNontransactional(); } finally { clr.unsetPrimary(); } }
if (pc.jdoIsPersistent())
else if (sm.getObject().jdoIsPersistent() && !sm.getObject().jdoIsDeleted())
if (!pc.jdoIsPersistent() && !pc.jdoIsTransactional()) else if (!pc.jdoIsPersistent() && pc.jdoIsTransactional())
else if (((PersistenceCapable)pc).jdoIsPersistent())
persistedPc = attachCopy(pc, false); else if (pc.jdoIsTransactional() && !pc.jdoIsPersistent()) else if (!pc.jdoIsPersistent()) else if (pc.jdoIsPersistent() && pc.jdoGetObjectId() == null)
final StateManager ownerSM = sm; if (pcElement.jdoIsPersistent())
if (!pkFieldPC.jdoIsPersistent())
final Object newOwner = sm.getObject(); if (pcNewValue.jdoIsPersistent()) final Object newOwner = sm.getObject(); if (pcNewKey.jdoIsPersistent())