beginTx(pm, task, threadId, txId);
// Execute first transaction (makePersistent)
A a1 = new A("a" + oid);
A a2 = new A("a" + oid + 1);
A a3 = new A("a" + oid + 2);
B b1 = new B("b" + oid);
B b2 = new B("b" + oid + 1);
B b3 = new B("b" + oid + 2);
pm.makePersistent(a1);
pm.makePersistent(a2);
pm.makePersistent(a3);
pm.makePersistent(b1);
pm.makePersistent(b2);
pm.makePersistent(b3);
Object oida1 = pm.getObjectId(a1);
Object oida2 = pm.getObjectId(a2);
Object oida3 = pm.getObjectId(a3);
Object oidb1 = pm.getObjectId(b1);
Object oidb2 = pm.getObjectId(b2);
Object oidb3 = pm.getObjectId(b3);
commitTx(pm, task, threadId, txId);
closePM(pm, threadId, txId, task, res);
pm = getPM(task, threadId, txId);
a1.getBs().add(b1);
assertTrue(b1.getAs().contains(a1));
a1.getBs().add(b2);
assertTrue(b2.getAs().contains(a1));
a2.getBs().add(b1);
assertTrue(b1.getAs().contains(a2));
a2.getBs().add(b2);
assertTrue(b2.getAs().contains(a2));
a2.getBs().add(b3);
assertTrue(b3.getAs().contains(a2));
a3.getBs().add(b2);
assertTrue(b2.getAs().contains(a3));
a3.getBs().add(b3);
assertTrue(b3.getAs().contains(a3));
a1.getBs().add(b3);
assertTrue(b3.getAs().contains(a1));
a1.getBs().remove(b1);
assertTrue(!b1.getAs().contains(a1));
b2.getAs().remove(a2);
assertTrue(!a2.getBs().contains(b2));
a1.setBs(a2.getBs());
// reload objects before testing effects of the above assignement
closePM(pm, threadId, txId, task, res);
pm = getPM(task, threadId, txId);
assertTrue(a1.getBs().contains(b1));
assertTrue(!a1.getBs().contains(b2));
assertTrue(a1.getBs().contains(b3));
assertTrue(a2.getBs().contains(b1));
assertTrue(!a2.getBs().contains(b2));
assertTrue(a2.getBs().contains(b3));
assertTrue(!a3.getBs().contains(b1));
assertTrue(a3.getBs().contains(b2));
assertTrue(a3.getBs().contains(b3));
assertTrue(b1.getAs().contains(a1));
assertTrue(b1.getAs().contains(a2));
assertTrue(!b1.getAs().contains(a3));
assertTrue(!b2.getAs().contains(a1));
assertTrue(!b2.getAs().contains(a2));
assertTrue(b2.getAs().contains(a3));
assertTrue(b3.getAs().contains(a1));
assertTrue(b3.getAs().contains(a2));
assertTrue(b3.getAs().contains(a3));
closePM(pm, threadId, txId, task, res);
pm = getPM(task, threadId, txId);
beginTx(pm, task, threadId, txId);
pm.deletePersistent(pm.getObjectById(oidb3, false));
commitTx(pm, task, threadId, txId);