Salad lolloverde = new Salad("Lollo verde", caloriesOther, "green");
deleteData(InterfaceAnimal.class);
deleteData(InterfaceFood.class);
Transaction tx = odmg.newTransaction();
tx.begin();
database.makePersistent(elephant);
database.makePersistent(cat);
database.makePersistent(snake);
database.makePersistent(tuna);
database.makePersistent(trout);
database.makePersistent(radiccio);
database.makePersistent(lolloverde);
tx.commit();
tx = odmg.newTransaction();
tx.begin();
OQLQuery query = odmg.newOQLQuery();
query.create("select animals from " + InterfaceAnimal.class.getName() +
" where age=$1");
query.bind(new Integer(age));
List animals = (List) query.execute();
tx.commit();
Iterator it = animals.iterator();
while (it.hasNext())
{
Object obj = it.next();
// System.out.println(obj);
}
assertEquals(3, animals.size());
//test independent objects
query = odmg.newOQLQuery();
tx.begin();
query.create("select food from " + InterfaceFood.class.getName() +
" where calories=$1");
query.bind(new Integer(calories));
List food = (List) query.execute();
tx.commit();
assertEquals(3, food.size());
}