/** * Convenience accessor for whether the object is transactional. * @param obj The object * @return Whether it is transactional */ public static boolean isTransactional(Object obj) { // TODO Change this to org.datanucleus.jpa.Persistable when we swap over if (obj instanceof PersistenceCapable) { return ((PersistenceCapable)obj).jdoIsTransactional(); } return false; }
/** * Convenience accessor for whether the object is transactional. * @param obj The object * @return Whether it is transactional */ public static boolean isTransactional(Object obj) { // TODO Change this to org.datanucleus.jpa.Persistable when we swap over if (obj instanceof PersistenceCapable) { return ((PersistenceCapable)obj).jdoIsTransactional(); } return false; }
/** Tests whether the parameter instance is transactional. * * Instances whose state is associated with the current transaction * return true. * *<P>Transient instances and instances of classes that do not implement * <code>PersistenceCapable</code> return <code>false</code>. * @see PersistenceCapable#jdoIsTransactional() * @param pc the <code>PersistenceCapable</code> instance. * @return <code>true</code> if the parameter instance is transactional. */ public static boolean isTransactional(Object pc) { if (pc instanceof PersistenceCapable) { return ((PersistenceCapable)pc).jdoIsTransactional(); } else { return implHelper.nonBinaryCompatibleIs(pc, isTransactional); } }
/** Tests whether the parameter instance is transactional. * * Instances whose state is associated with the current transaction * return true. * *<P>Transient instances and instances of classes that do not implement * <code>PersistenceCapable</code> return <code>false</code>. * @see PersistenceCapable#jdoIsTransactional() * @param pc the <code>PersistenceCapable</code> instance. * @return <code>true</code> if the parameter instance is transactional. */ public static boolean isTransactional(Object pc) { if (pc instanceof PersistenceCapable) { return ((PersistenceCapable)pc).jdoIsTransactional(); } else { return implHelper.nonBinaryCompatibleIs(pc, isTransactional); } }
/** * 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); }
if( sms[i] != null && sms[i].getObject() != null && (sms[i].getObject().jdoIsPersistent() || sms[i].getObject().jdoIsTransactional()))
/** * 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() && !pc.jdoIsTransactional()) else if (!pc.jdoIsPersistent() && pc.jdoIsTransactional())
persistedPc = attachCopy(pc, false); else if (pc.jdoIsTransactional() && !pc.jdoIsPersistent())