PersistenceManager persist = new PersistenceManager(driver, database, login, password);
ConnectionWrapper cw = persist.getConnectionWrapper();
// add a large number of entries
for (int x = 1; x <= 100; x++)
{
SimplestObject so = new SimplestObject();
so.setFoo((double) x);
persist.saveObject(cw, so);
}
cw.commitAndDiscard();
persist.close();
persist = new PersistenceManager(driver, database, login, password);
// construct a query that returns the objects with where foo is 3,66 and
// 99
SimplestObject different = new SimplestObject(100.0);
SimplestObject larger = new SimplestObject(98.0);
SimplestObject equal = new SimplestObject(66.0);
SimplestObject smallerOrEquals = new SimplestObject(3.0);
SimplestObject largerOrEquals = new SimplestObject(3.0);
And one = new And(new GreaterOrEqual(largerOrEquals), new LessOrEqual(smallerOrEquals));
And two = new And(new Different(different), new Greater(larger));
List<SimplestObject> list = persist.getObjects(SimplestObject.class, new Or(one, two, new Equal(equal)));
assertEquals(3, list.size());