db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpmo...@zantar.net
Subject Re: Error when using Criteria.SetLimit() with mysql
Date Wed, 18 Jun 2003 21:17:46 GMT
Please accept my appologies, I have found the error of my ways.

I needed to add the the following property to my Torque.properties:

torque.database.bookstore.adapter=mysql

Thanks Again,
Duane


On Wed, 18 Jun 2003 dpmohne@zantar.net wrote:

> I am recieving the following error when attempting to do a select with a
> limit:
>
> java.lang.NullPointerException
> 	at org.apache.torque.util.BasePeer.createQuery(BasePeer.java:1283)
> 	at
> org.apache.torque.util.BasePeer.createQueryString(BasePeer.java:927)
> 	at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1359)
> 	at
> net.zantar.om.BaseAuthorPeer.doSelectVillageRecords(BaseAuthorPeer.java:369)
> 	at
> net.zantar.om.BaseAuthorPeer.doSelectVillageRecords(BaseAuthorPeer.java:336)
> 	at net.zantar.om.BaseAuthorPeer.doSelect(BaseAuthorPeer.java:304)
> 	at net.zantar.om.AuthorPeer.doSelectPage(AuthorPeer.java:30)
> 	at net.zantar.LimitTest.main(LimitTest.java:30)
> rethrown as org.apache.torque.TorqueException
> 	at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1372)
> 	at
> net.zantar.om.BaseAuthorPeer.doSelectVillageRecords(BaseAuthorPeer.java:369)
> 	at
> net.zantar.om.BaseAuthorPeer.doSelectVillageRecords(BaseAuthorPeer.java:336)
> 	at net.zantar.om.BaseAuthorPeer.doSelect(BaseAuthorPeer.java:304)
> 	at net.zantar.om.AuthorPeer.doSelectPage(AuthorPeer.java:30)
> 	at net.zantar.LimitTest.main(LimitTest.java:30)
>
> The revelant code from AuthorPeer.java is as follows:
>
> 	public static List doSelectPage(int Limit, int Offset) throws
> Exception
> 	{
> 	  Criteria crit = new Criteria();
> 	  crit.setOffset(Offset);
> 	  crit.setLimit(Limit);
> 	  return doSelect(crit);
> 	}
>
> My Torque.properties is as follows:
>
> log4j.rootCategory = DEBUG, default
> log4j.appender.default = org.apache.log4j.FileAppender
> log4j.appender.default.file = ./torque.log
> log4j.appender.default.layout = org.apache.log4j.SimpleLayout
>
>
> torque.database.default = bookstore
> torque.database.bookstore.driver = org.gjt.mm.mysql.Driver
> torque.database.bookstore.url = jdbc:mysql://127.0.0.1/bookstore
> torque.database.bookstore.username = root
> torque.database.bookstore.password =
>
> torque.dsfactory.bookstore.factory=org.apache.torque.dsfactory.Jdbc2PoolDataSourceFactory
> torque.dsfactory.bookstore.pool.defaultMaxActive=10
> torque.dsfactory.bookstore.pool.testOnBorrow=true
> torque.dsfactory.bookstore.pool.validationQuery=SELECT 1
> torque.dsfactory.bookstore.connection.driver = org.gjt.mm.mysql.Driver
> torque.dsfactory.bookstore.connection.url =
> jdbc:mysql://127.0.0.1/bookstore
> torque.dsfactory.bookstore.connection.user = root
> torque.dsfactory.bookstore.connection.password =
>
>
> Please tell me I am doing something wrong.
>
> Thanks in advance.
>
> Duane
>
>
> ---------------------------------------------------------------------
> 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