SelectQuery query = new SelectQuery(ClientMtTable1.class);
List objects = child.performQuery(query);
assertEquals(4, objects.size());
ClientMtTable1 childNew = child.newObject(ClientMtTable1.class);
childNew.setGlobalAttribute1("NNN");
ClientMtTable1 childModified = (ClientMtTable1) objects.get(0);
childModified.setGlobalAttribute1("MMM");
ClientMtTable1 childCommitted = (ClientMtTable1) objects.get(1);
// delete AND modify
ClientMtTable1 childDeleted = (ClientMtTable1) objects.get(2);
child.deleteObject(childDeleted);
childDeleted.setGlobalAttribute1("DDD");
ClientMtTable1 childHollow = (ClientMtTable1) objects.get(3);
child.invalidateObjects(Collections.singleton(childHollow));
child.commitChanges();
assertEquals(PersistenceState.COMMITTED, childNew.getPersistenceState());
assertEquals(PersistenceState.COMMITTED, childModified.getPersistenceState());
assertEquals(PersistenceState.COMMITTED, childCommitted.getPersistenceState());
assertEquals(PersistenceState.TRANSIENT, childDeleted.getPersistenceState());
assertEquals(PersistenceState.HOLLOW, childHollow.getPersistenceState());
ClientMtTable1 parentNew = (ClientMtTable1) context.getGraphManager().getNode(
childNew.getObjectId());
ClientMtTable1 parentModified = (ClientMtTable1) context
.getGraphManager()
.getNode(childModified.getObjectId());
ClientMtTable1 parentCommitted = (ClientMtTable1) context
.getGraphManager()
.getNode(childCommitted.getObjectId());
ClientMtTable1 parentDeleted = (ClientMtTable1) context
.getGraphManager()
.getNode(childDeleted.getObjectId());
ClientMtTable1 parentHollow = (ClientMtTable1) context.getGraphManager().getNode(
childHollow.getObjectId());
assertNotNull(parentNew);
assertEquals(PersistenceState.COMMITTED, parentNew.getPersistenceState());
assertEquals("NNN", parentNew.getGlobalAttribute1());