Child mapChild3 = database.newInstance(Child.class);
mapChild3.setName("map3");
test.getChildren().put("3", mapChild3);
database.save(test);
ORID testRid = database.getRecordByUserObject(test, false).getIdentity();
ORID map1Rid = database.getRecordByUserObject(mapChild1, false).getIdentity();
ORID map2Rid = database.getRecordByUserObject(mapChild2, false).getIdentity();
ORID map3Rid = database.getRecordByUserObject(mapChild3, false).getIdentity();
database.close();
database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
database.delete(testRid);
mapChild1 = database.load(map1Rid);
mapChild2 = database.load(map2Rid);
mapChild3 = database.load(map3Rid);
Assert.assertNull(mapChild1);
Assert.assertNull(mapChild2);
Assert.assertNull(mapChild3);
database.close();
database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
// MAP UPDATE TEST
test = database.newInstance(JavaCascadeDeleteTestClass.class);
mapChild1 = database.newInstance(Child.class);
mapChild1.setName("map1");
test.getChildren().put("1", mapChild1);
mapChild2 = database.newInstance(Child.class);
mapChild2.setName("map2");
test.getChildren().put("2", mapChild2);
mapChild3 = database.newInstance(Child.class);
mapChild3.setName("map3");
test.getChildren().put("3", mapChild3);
Child mapChild4 = database.newInstance(Child.class);
mapChild4.setName("map4");
test.getChildren().put("4", mapChild4);
Child mapChild5 = database.newInstance(Child.class);
mapChild5.setName("map5");
test.getChildren().put("5", mapChild5);
database.save(test);
testRid = database.getIdentity(test);
map1Rid = database.getRecordByUserObject(mapChild1, false).getIdentity();
map2Rid = database.getRecordByUserObject(mapChild2, false).getIdentity();
map3Rid = database.getRecordByUserObject(mapChild3, false).getIdentity();
ORID map4Rid = database.getRecordByUserObject(mapChild4, false).getIdentity();
ORID map5Rid = database.getRecordByUserObject(mapChild5, false).getIdentity();
database.close();
database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
test = database.load(testRid);
Assert.assertNotNull(test.getChildren().get("1"));