OpenJPAEntityManager pm = getPM();
pm.setOptimistic(false);
pm.validateChanges(); // no-op outside trans
startTx(pm);
RuntimeTest1 pc = (RuntimeTest1) pm.find(RuntimeTest1.class, _oid);
pc.setIntField1(100);
RuntimeTest1 npc = new RuntimeTest1();
pm.persist(npc);
Object noid = pm.getObjectId(npc);
pm.validateChanges();
assertEquals(100, pc.getIntField1());
assertTrue(pm.isPersistent(npc));
pc.setIntField1(200);
npc.setIntField1(300);
rollbackTx(pm);
assertEquals(1, pc.getIntField1());
assertFalse(pm.isPersistent(npc));
assertEquals(0, npc.getIntField1());
endEm(pm);
pm = getPM();
try {
RuntimeTest1 temp =
(RuntimeTest1) pm.find(RuntimeTest1.class, noid);
fail("Object should not exist." + temp.getIntField() + "::" +
temp.getIntField1());
} catch (Exception jonfe) {
}
endEm(pm);
}