Obj2 o2 = new Obj2();
o2.setDescription("description");
Obj3 o3 = new Obj3();
o3.setAddress("puey 600");
Obj4 o4 = new Obj4();
o4.setPrueba("this is a test");
o1.setObj4(o4);
admin.openAtomicBlock();
admin.save(o1);
admin.save(o2);
admin.save(o3);
admin.closeAtomicBlock();
Obj1 oo1 = new Obj1();
Obj2 oo2 = new Obj2();
Obj3 oo3 = new Obj3();
Assert.assertTrue(admin.obtain(oo1, "name = 'diego'"));
Assert.assertTrue(admin.obtain(oo2, "description = 'description'"));
Assert.assertTrue(admin.obtain(oo3, "address = 'puey 600'"));
Assert.assertEquals("diego", oo1.getName());
Assert.assertEquals("description", oo2.getDescription());
Assert.assertEquals("puey 600", oo3.getAddress());
admin.openAtomicBlock();
admin.save(o2);
admin.save(o3);
admin.cancelAtomicBlock();
ArrayList array1 = admin.obtainAll(Obj2.class, "id > 0");
ArrayList array2 = admin.obtainAll(Obj3.class, "id > 0");
Assert.assertEquals(1, array1.size());
Assert.assertEquals(1, array2.size());
admin.openAtomicBlock();
admin.save(o1);
admin.closeAtomicBlock();
ArrayList array3 = admin.obtainAll(Obj1.class, "id > 0");
Assert.assertEquals(2, array3.size());
Obj4 oo4 = new Obj4();
ArrayList array4 = admin.obtainAll(Obj4.class, "id > 0");
Assert.assertEquals(2, array4.size());
}