*/
@Test
public void testDeleteComplexObject() throws Exception
{
// create the database connection
PersistenceManager persist = new PersistenceManager(driver, database, login, password);
ComplexObject co1 = new ComplexObject(new double[] { 1.1, 2.2, 3.3, 4.4 });
// saving the object gives it an outside reference
persist.saveObject(co1);
// create an array of complex objects
ComplexObject[] coArray = new ComplexObject[3];
for (int x = 0; x < coArray.length - 1; x++)
{
ComplexObject co = new ComplexObject();
co.setData(new double[] { x, x * 2, x * 3 });
SimpleObject so = new SimpleObject();
so.setAge((long) x);
co.setObject(so);
coArray[x] = co;
}
// one of the complex objects in the array has an outside reference
coArray[2] = co1;
ComplexArrayObject cao = new ComplexArrayObject();
cao.setData(coArray);
persist.saveObject(cao);
persist.close();
// check that there is one ComplexArrayObject
persist = new PersistenceManager(driver, database, login, password);
List<ComplexArrayObject> res = persist.getObjectsMatching(new ComplexArrayObject());
assertEquals(1, res.size());
ComplexArrayObject ob1 = res.get(0);
// check that the ComplexArrayObject contains 3 ComplexObjects
assertEquals(3, ob1.getData().length);
persist.close();
persist = new PersistenceManager(driver, database, login, password);
persist.deleteObjects(new ComplexArrayObject());
List<ComplexObject> tmp = persist.getObjectsMatching(new ComplexObject());
assertEquals(1, tmp.size());
persist.close();
}