db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Göschl,Siegfried" <Siegfried.Goes...@drei.com>
Subject RE: Criteria.addAscendingOrderByColumn(field) NullPointerEx
Date Mon, 15 Dec 2003 20:49:57 GMT
Hi Rolf,

I actually wrote the following test case for my project

>>> Code Snippet >>>
Criteria criteria2 = new Criteria();
criteria2.addAscendingOrderByColumn( CartorderposPeer.DATECREATED );
criteria2.setLimit( 50 );			
cartOrderPosList = product.getCartorderposs( criteria2 );
int resultSize2 = cartOrderPosList.size();
assertTrue( resultSize2 == 50 );
<<< Code Snippet <<<

I also had a look at the BasePeer and I think I might have seen a similiar problem before.
The problem might be

DB db = Torque.getDB(criteria.getDbName());
... some code ...
db.ignoreCaseInOrderBy(...)

I might be wrong but you either have to set the 
+) database name in the criteria or 
+) create the appropriate XXXBasePeer.DATABASE_NAME using the schema.xml (check the DTD for
database)

Cheers,

Siegfried Goeschl



-----Original Message-----
From: mr.x [mailto:mr.x@tele2.ch]
Sent: Monday, December 15, 2003 8:49 PM
To: torque-user@db.apache.org
Subject: Criteria.addAscendingOrderByColumn(field) NullPointerEx


Hello all

I'm currently developing my first "torque based" java-app. (Almost)
everything works fine; but if i use addAscendingOrderByColumn() with a
character field or use setLimit() on a Criteria object i get a
NullPointerException:
java.lang.NullPointerException
        at org.apache.torque.util.BasePeer.createQuery(BasePeer.java:1277)
        at
org.apache.torque.util.BasePeer.createQueryString(BasePeer.java:984)
        at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1391)
        at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1368)
(Sample=addAscendingOrderByColumn)

I'm using torque 3.1 on winxp with mysql 4.0.15

Is this a torque "feature" or a "config issue" ? Is it possible to sort and
or limit the result set in another way ? (... groupBy works i know -> thats
not sorting ;->)

Thanks for help

Regards 

Rolf
        


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message