// add a large number of entries
for (int x = 0; x < 200; x++)
{
SimplestObject so = new SimplestObject();
so.setFoo((double) x);
ComplexObject co = new ComplexObject();
co.setSimplestObject(so);
persist.saveObject(cw, co);
}
cw.commitAndDiscard();
// make sure all entries have been added
List<ComplexObject> list = persist.getObjectsMatching(new ComplexObject());
assertEquals(200, list.size());
// select using sorting
SimplestObject simpleObject = new SimplestObject();
simpleObject.setFoo(0.0);
ComplexObject orderObject = new ComplexObject();
orderObject.setSimplestObject(simpleObject);
list = persist.getObjects(ComplexObject.class, new Descending(orderObject));
assertEquals(200, list.size());
assertEquals((Double) 199.0, list.get(0).getSimplestObject().getFoo());
list = persist.getObjects(ComplexObject.class, new Ascending(orderObject));