Пример #1
0
 @Test
 public void testDeletePersistentNew_NoTxn() {
   PersistenceManager pm = getPersistenceManager();
   KitchenSink ks = KitchenSink.newKitchenSink("key");
   pm.makePersistent(ks);
   String keyStr = ks.key;
   pm.deletePersistent(ks);
   pm.close();
   pm = PMF.get().getPersistenceManager();
   try {
     pm.getObjectById(KitchenSink.class, keyStr);
     fail("expected onfe");
   } catch (JDOObjectNotFoundException onfe) {
     // good
   }
 }
Пример #2
0
  @Test
  public void testNonTransactionalDelete() {
    PersistenceManager pm = getPersistenceManager();
    String keyStr = "key";

    beginTxn();
    pm.makePersistent(KitchenSink.newKitchenSink(keyStr));
    commitTxn();
    KitchenSink ks = pm.getObjectById(KitchenSink.class, keyStr);
    assertNotNull(ks);
    pm.deletePersistent(ks);
    try {
      pm.getObjectById(KitchenSink.class, keyStr);
      fail("expected onfe");
    } catch (JDOObjectNotFoundException onfe) {
      // good
    }
  }
Пример #3
0
 @Test
 public void testDeletePersistentNew() {
   PersistenceManager pm = getPersistenceManager();
   beginTxn();
   KitchenSink ks = KitchenSink.newKitchenSink("key");
   pm.makePersistent(ks);
   String keyStr = ks.key;
   pm.deletePersistent(ks);
   commitTxn();
   beginTxn();
   try {
     pm.getObjectById(KitchenSink.class, keyStr);
     fail("expected onfe");
   } catch (JDOObjectNotFoundException onfe) {
     // good
   } finally {
     rollbackTxn();
   }
 }