CayenneContext c1 = (CayenneContext) runtime.getContext();
CayenneContext c2 = (CayenneContext) runtime.getContext();
ClientMtTable1 o1 = (ClientMtTable1) Cayenne.objectForQuery(
c1,
new ObjectIdQuery(new ObjectId("MtTable1", "TABLE1_ID", 1)));
// do not resolve objects in question in the second context and see if the merge
// causes any issues...
assertEquals(1, o1.getTable2Array().size());
ClientMtTable2 o1r = c1.newObject(ClientMtTable2.class);
o1r.setGlobalAttribute("X");
o1.addToTable2Array(o1r);
c1.commitChanges();
assertEquals(2, o1.getTable2Array().size());
assertFalse(c1.internalGraphManager().hasChanges());
assertFalse(c2.internalGraphManager().hasChanges());
ClientMtTable1 o2 = (ClientMtTable1) Cayenne.objectForQuery(
c2,
new ObjectIdQuery(new ObjectId("MtTable1", "TABLE1_ID", 1)));
assertEquals(2, o2.getTable2Array().size());
}