admin.executeQuery("DROP TABLE Delete1Delete2Delete2");
admin.executeQuery("DROP TABLE Delete2Delete1Delete1");
Delete2 d2a2 = new Delete2();
d2a2.setName("delete2 - prueba1");
Delete1 d1a2 = new Delete1();
d1a2.setDescription("delete2-delete1-desc1");
Delete1 d1b2 = new Delete1();
d1b2.setDescription("delete2-delete1-desc2");
ArrayList a1 = new ArrayList();
a1.add(d1a2);
a1.add(d1b2);
d2a2.setDelete1(a1);
Delete2 d2b2 = new Delete2();
d2b2.setName("delete2 - prueba2");
Delete1 d1c2 = new Delete1();
d1c2.setDescription("delete2-delete1-desc3");
Delete1 d1d2 = new Delete1();
d1d2.setDescription("delete2-delete1-desc4");
ArrayList a2 = new ArrayList();
a2.add(d1c2);
a2.add(d1d2);
d2b2.setDelete1(a2);
ArrayList array2 = new ArrayList();
array2.add(d2a2);
array2.add(d2b2);
Delete1 d3 = new Delete1();
d3.setDescription("description delete1");
d3.setDelete2(array2);
Assert.assertTrue(admin.save(d3));
Assert.assertTrue(admin.obtain(d3, "description = 'description delete1'"));
((Delete1) d3.getDelete2().get(0).getDelete1().get(0)).setDescription("new description2");
((Delete1) d3.getDelete2().get(1).getDelete1().get(0)).setDescription("description modify2");
d3.getDelete2().get(0).setName("name modify2");
Delete2 d2q = new Delete2();
d2q.setName("delete2 - prueba - added");
d3.getDelete2().add(d2q);
Assert.assertTrue(admin.modify(d3));
Delete1 d4 = new Delete1();
Assert.assertTrue(admin.obtain(d4, "description = 'description delete1'"));
Assert.assertEquals("new description2",
((Delete1)d4.getDelete2().get(0).getDelete1().get(0)).getDescription());
}