Child setChild3 = database.newInstance(Child.class);
setChild3.setName("set3");
test.getSet().add(setChild3);
database.save(test);
ORID testRid = database.getRecordByUserObject(test, false).getIdentity();
ORID list1Rid = database.getRecordByUserObject(listChild1, false).getIdentity();
ORID list2Rid = database.getRecordByUserObject(listChild2, false).getIdentity();
ORID list3Rid = database.getRecordByUserObject(listChild3, false).getIdentity();
ORID set1Rid = database.getRecordByUserObject(setChild1, false).getIdentity();
ORID set2Rid = database.getRecordByUserObject(setChild2, false).getIdentity();
ORID set3Rid = database.getRecordByUserObject(setChild3, false).getIdentity();
database.close();
database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
database.delete(testRid);
listChild1 = database.load(list1Rid);
listChild2 = database.load(list2Rid);
listChild3 = database.load(list3Rid);
setChild1 = database.load(set1Rid);
setChild2 = database.load(set2Rid);
setChild3 = database.load(set3Rid);
Assert.assertNull(listChild1);
Assert.assertNull(listChild2);
Assert.assertNull(listChild3);
Assert.assertNull(setChild1);
Assert.assertNull(setChild2);
Assert.assertNull(setChild3);
// LIST UPDATE TEST
test = database.newInstance(JavaCascadeDeleteTestClass.class);
listChild1 = database.newInstance(Child.class);
listChild1.setName("list1");
test.getList().add(listChild1);
listChild2 = database.newInstance(Child.class);
listChild2.setName("list2");
test.getList().add(listChild2);
listChild3 = database.newInstance(Child.class);
listChild3.setName("list3");
test.getList().add(listChild3);
Child listChild4 = database.newInstance(Child.class);
listChild4.setName("list4");
test.getList().add(listChild4);
setChild1 = database.newInstance(Child.class);
setChild1.setName("set1");
test.getSet().add(setChild1);
setChild2 = database.newInstance(Child.class);
setChild2.setName("set2");
test.getSet().add(setChild2);
setChild3 = database.newInstance(Child.class);
setChild3.setName("set3");
test.getSet().add(setChild3);
Child setChild4 = database.newInstance(Child.class);
setChild4.setName("set4");
test.getSet().add(setChild4);
database.save(test);
testRid = database.getRecordByUserObject(test, false).getIdentity();
list1Rid = database.getRecordByUserObject(listChild1, false).getIdentity();
list2Rid = database.getRecordByUserObject(listChild2, false).getIdentity();
list3Rid = database.getRecordByUserObject(listChild3, false).getIdentity();
ORID list4Rid = database.getRecordByUserObject(listChild4, false).getIdentity();
set1Rid = database.getRecordByUserObject(setChild1, false).getIdentity();
set2Rid = database.getRecordByUserObject(setChild2, false).getIdentity();
set3Rid = database.getRecordByUserObject(setChild3, false).getIdentity();
ORID set4Rid = database.getRecordByUserObject(setChild4, false).getIdentity();
database.close();
database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
test = database.load(testRid);
test.getList().remove(listChild4);