Re: [ojb-users] OQL and order by clauses
Brought to you by:
thma
From: Jakob B. <jbr...@ho...> - 2002-05-09 17:12:53
|
hi david, i cannot reproduce this error. the following sample code produced a list of persons sorted by id descending: crit = new Criteria(); crit.addOrderBy("id",false); query = new QueryByCriteria(Person.class, crit); broker.getCollectionByQuery(query); please set the loglevel for SqlGenerator to DEBUG to see the generated SQL. modify the following line in OJB.properties: # Loger for SqlGenerator, useful for debugging generation of SQL ojb.broker.accesslayer.SqlGenerator.LogLevel=DEBUG i'm working with the current stuff from cvs. hth jakob ----- Original Message ----- From: "David Rault" <cas...@fr...> To: <obj...@li...> Sent: Thursday, May 09, 2002 5:15 PM Subject: [ojb-users] OQL and order by clauses > 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 > > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Objectbridge-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-users > |