db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <d...@solaraccess.com>
Subject setLimit NPEs?
Date Mon, 16 Feb 2004 20:58:33 GMT
Howdy,

I'm doing something pretty simple and getting an NPE so... maybe I'm
just doing something trivially wrong.

If I comment out the setLimit line it all works fine, otherwise I get
the NPE.

I'm running Torque 3.0.2 (don't ask, don't know) and MySQL, Java 1.4.1

Any ideas? I'd feel better if I couldn't access the DB at all :/ I have
the adapter set to mysql in torque.properties and have appended the
props file at the end of the email.

TIA,
Dave

PS: You know, I'm all for text-only email, but damn, even minor
formatting is REALLY useful.

--- My dopey test code ---

import org.apache.torque.Torque;
import org.apache.torque.util.Criteria;
import com.solaraccess.db.ThePeer;

public class Test02 {
    public static void main(String[] argb) throws Exception {
        Torque.init("./torque.properties");
        Criteria c = new Criteria();
        c.add(ThePeer.THETYPE, "THETYPEIWANT");
        c.setLimit(5);
        ThePeer.doSelect(c); // Just want NPE; toss results
    }
}

--- The exception ---


Exception in thread "main" java.lang.NullPointerException
	at org.apache.torque.util.BasePeer.createQuery(BasePeer.java:1317)
	at org.apache.torque.util.BasePeer.createQueryString(BasePeer.java:927)
	at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1360)
	at com.rea.db.BaseStoryPeer.doSelectVillageRecords(BaseStoryPeer.java:438)
	at com.rea.db.BaseStoryPeer.doSelectVillageRecords(BaseStoryPeer.java:405)
	at com.rea.db.BaseStoryPeer.doSelect(BaseStoryPeer.java:374)
	at Test02.main(Test02.java:11)
rethrown as org.apache.torque.TorqueException
	at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1373)
	at com.rea.db.BaseStoryPeer.doSelectVillageRecords(BaseStoryPeer.java:438)
	at com.rea.db.BaseStoryPeer.doSelectVillageRecords(BaseStoryPeer.java:405)
	at com.rea.db.BaseStoryPeer.doSelect(BaseStoryPeer.java:374)
	at Test02.main(Test02.java:11)
Caused by: java.lang.NullPointerException
	at org.apache.torque.util.BasePeer.createQuery(BasePeer.java:1317)
	at org.apache.torque.util.BasePeer.createQueryString(BasePeer.java:927)
	at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1360)
	... 4 more

--- The slightly-edited properties file ---

torque.applicationRoot = .

log4j.category.org.apache.torque = ALL, org.apache.torque
log4j.appender.org.apache.torque = org.apache.log4j.FileAppender
log4j.appender.org.apache.torque.file = ${torque.applicationRoot}/logs/torque.log
log4j.appender.org.apache.torque.layout = org.apache.log4j.PatternLayout
log4j.appender.org.apache.torque.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.org.apache.torque.append = false

torque.database.default=sandbox

torque.database.sandbox.adapter=mysql

torque.dsfactory.sandbox.factory=org.apache.torque.dsfactory.TorqueDataSourceFactory
torque.dsfactory.sandbox.pool.defaultMaxConnections=10
torque.dsfactory.sandbox.pool.maxExpiryTime=3600
torque.dsfactory.sandbox.pool.connectionWaitTimeout=10
torque.dsfactory.sandbox.connection.driver = org.gjt.mm.mysql.Driver

torque.dsfactory.sandbox.connection.url = jdbc:mysql://thehost.com:3306/thedb
torque.dsfactory.sandbox.connection.user = thedbuser
torque.dsfactory.sandbox.connection.password = thedbpasswd
torque.idbroker.cleverquantity=true
torque.manager.useCache = true


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message