[ojb-users] OQL and order by clauses
Brought to you by:
thma
From: David R. <cas...@fr...> - 2002-05-09 15:18:07
|
hi all i'm new to ObjectBridge but it seems quite an impressive piece of work! i just met some confusing behaviour so i'm asking to see if it's because i missed something : i'm trying to add an 'order by' clause to my request but the result never gets ordered i tried both persistentBroker layer and ODMG layer they both behave in the same way here is what i wrote : PersistenceBroker pb = PersistenceBrokerFactory.createPersistenceBroker("repository.xml"); Criteria criteria = new Criteria(); criteria.addOrderBy("id", false); Query query = new QueryByCriteria(test.DVDObject.class, criteria); java.util.Iterator iter = pb.getCollectionByQuery(query).iterator(); while (iter.hasNext()) { System.out.println(iter.next()); } and i get this on the standard output (the 'id' is the value between parenthesis) : test.DVDObjectImpl (68)[Superman II] test.DVDObjectImpl (36)[Men in Black] test.DVDObjectImpl (48)[Ninja Scroll] test.DVDObjectImpl (16)[Cybersix - vol. 1] test.DVDObjectImpl (28)[Evil Cult] test.DVDObjectImpl (102)[Ghost in the Shell] test.DVDObjectImpl (9)[Anastasia] not really sorted so what am i doing wrong ?? i'm using v0.8.400 with sun jdk1.4 thank you for your help David |