// }
public void testAttachDetachSuccess()
throws Exception {
OpenJPAEntityManager pm1 = getPM(false, false);
LockGroupPC pc1 = (LockGroupPC) pm1.find(LockGroupPC.class, oid);
Object detached = pm1.detach(pc1);
startTx(pm1);
pc1.setLockGroup0IntField(1);
pc1.setUnlockedStringField("pm1 changed value");
endTx(pm1);
endEm(pm1);
/*
// won't work without non-transient detached state
ByteArrayOutputStream baos = new ByteArrayOutputStream ();
ObjectOutputStream oos = new ObjectOutputStream (baos);
oos.writeObject (detached);
oos.close ();
baos.close ();
ByteArrayInputStream bais =
new ByteArrayInputStream (baos.toByteArray ());
ObjectInputStream ois = new ObjectInputStream (bais);
LockGroupPC clone = (LockGroupPC) ois.readObject ();
*/
LockGroupPC clone = (LockGroupPC) detached;
clone.setLockGroup1IntField(2);
clone.setUnlockedStringField("pm2 value");
OpenJPAEntityManager pm2 = getPM(false, false);
startTx(pm2);
pm2.merge(clone);
endTx(pm2);