/** * Rolls back the current transaction if it is active */ @Override public void rollbackTransaction() { if (openTrasactionCalls < 1) { debugLog("rolling back transaction: no open transactions: " + openTrasactionCalls); return; } debugLog("Rollback transaction, isActive: " + isActiveTransaction()); try { if (isActiveTransaction() && transactionStatus != TXN_STATUS.ROLLBACK) { currentTransaction.rollback(); } } finally { openTrasactionCalls = 0; transactionStatus = TXN_STATUS.ROLLBACK; // remove all detached objects from the cache, since the transaction is // being rolled back they are no longer relevant, and this prevents them // from reattaching in future transactions pm.evictAll(); } }
public Object doInJdo(PersistenceManager pm) throws JDOException { pm.evictAll(); return null; } }, true);
public Object doInJdo(PersistenceManager pm) throws JDOException { pm.evictAll(entities); return null; } }, true);
public void evictAll(Object... pcs) { getPM().evictAll(pcs); }
public void evictAll(Collection pcs) { getPM().evictAll(pcs); }
public void evictAll(boolean subclasses, Class cls) { getPM().evictAll(subclasses, cls); }
public void evictAll() { getPM().evictAll(); }
/** * Rolls back the current transaction if it is active */ public void rollbackTransaction() { if (openTrasactionCalls < 1) { return; } openTrasactionCalls = 0; if (currentTransaction.isActive() && transactionStatus != TXN_STATUS.ROLLBACK) { transactionStatus = TXN_STATUS.ROLLBACK; // could already be rolled back currentTransaction.rollback(); // remove all detached objects from the cache, since the transaction is // being rolled back they are no longer relevant, and this prevents them // from reattaching in future transactions pm.evictAll(); } }
/** * Rolls back the current transaction if it is active */ @Override public void rollbackTransaction() { if (openTrasactionCalls < 1) { debugLog("rolling back transaction: no open transactions: " + openTrasactionCalls); return; } debugLog("Rollback transaction, isActive: " + currentTransaction.isActive()); try { if (currentTransaction.isActive() && transactionStatus != TXN_STATUS.ROLLBACK) { currentTransaction.rollback(); } } finally { openTrasactionCalls = 0; transactionStatus = TXN_STATUS.ROLLBACK; // remove all detached objects from the cache, since the transaction is // being rolled back they are no longer relevant, and this prevents them // from reattaching in future transactions pm.evictAll(); } }
/** * Rolls back the current transaction if it is active */ @Override public void rollbackTransaction() { if (openTrasactionCalls < 1) { debugLog("rolling back transaction: no open transactions: " + openTrasactionCalls); return; } debugLog("Rollback transaction, isActive: " + currentTransaction.isActive()); try { if (currentTransaction.isActive() && transactionStatus != TXN_STATUS.ROLLBACK) { currentTransaction.rollback(); } } finally { openTrasactionCalls = 0; transactionStatus = TXN_STATUS.ROLLBACK; // remove all detached objects from the cache, since the transaction is // being rolled back they are no longer relevant, and this prevents them // from reattaching in future transactions pm.evictAll(); } }
/** * Rolls back the current transaction if it is active */ @Override public void rollbackTransaction() { if (openTrasactionCalls < 1) { debugLog("rolling back transaction: no open transactions: " + openTrasactionCalls); return; } debugLog("Rollback transaction, isActive: " + currentTransaction.isActive()); try { if (currentTransaction.isActive() && transactionStatus != TXN_STATUS.ROLLBACK) { currentTransaction.rollback(); } } finally { openTrasactionCalls = 0; transactionStatus = TXN_STATUS.ROLLBACK; // remove all detached objects from the cache, since the transaction is // being rolled back they are no longer relevant, and this prevents them // from reattaching in future transactions pm.evictAll(); } }
@Test public void testNoEvictNew() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); TestClass tc = new TestClass(); tc.setInt(5); pm.makePersistent(tc); pm.evictAll(); pm.evictAll(tc); pm.evictAll(false, TestClass.class); pm.currentTransaction().commit(); pm.currentTransaction().begin(); assertEquals(5, tc.getInt()); assertTrue(JDOHelper.isPersistent(tc)); tc.setInt(55); assertEquals(55, tc.getInt()); //does commit work? pm.deletePersistent(tc); pm.currentTransaction().commit(); pm.close(); }
@Test public void testNoEvict() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); TestClass tc = new TestClass(); tc.setInt(55); pm.makePersistent(tc); pm.currentTransaction().commit(); pm.currentTransaction().begin(); pm.evictAll(); pm.evictAll(tc); pm.evictAll(true, TestClass.class); assertEquals(55, tc.getInt()); tc.setInt(555); assertEquals(555, tc.getInt()); assertTrue(JDOHelper.isPersistent(tc)); //does commit work? pm.deletePersistent(tc); pm.currentTransaction().commit(); pm.close(); }
pm.evictAll(false, PersistenceCapableImpl.class); pm.evictAll(true, DBArrayList.class); assertEquals(ObjectState.PERSISTENT_CLEAN, JDOHelper.getObjectState(tc)); pm.evictAll(true, PersistenceCapableImpl.class); assertEquals(ObjectState.HOLLOW_PERSISTENT_NONTRANSACTIONAL, JDOHelper.getObjectState(tc)); pm.evictAll(false, TestClass.class); assertEquals(ObjectState.HOLLOW_PERSISTENT_NONTRANSACTIONAL, JDOHelper.getObjectState(tc)); pm.evictAll(true, TestClass.class); assertEquals(ObjectState.HOLLOW_PERSISTENT_NONTRANSACTIONAL, JDOHelper.getObjectState(tc));
tt2 = null; tt3 = null; pm.evictAll(oa); oa = null; pm.currentTransaction().commit();