db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Eade <se...@backstagetech.com.au>
Subject Re: Postgres - Problem in selecting on timestamp columns
Date Wed, 25 Feb 2004 13:06:18 GMT
Yiannis Maglaras wrote:

>I am running the latest version of torque (v.3-1) and using
>pg74.1jdbc3.jar as postgres jdbc driver.
>I have a table that contains a timestamp field, called send_date. I can
>populate this table with new entries, but when it comes to selecting on
>this field, 
> 
>Timestamp ts = new java.sql.Timestamp(System.currentTimeMillis());
>...
>Criteria crit = new Criteria();
>crit.add(MessagesPeer.SEND_DATE, ts, Criteria.LESS_EQUAL);
> 
>I am getting back java exceptions
> 
>[starter] java.lang.NullPointerException
>  [starter]     at
>org.apache.torque.util.SqlExpression.build(SqlExpression.java:283)
>  [starter]     at
>
>
<snip/>

>Is anyone aware of this issue? Thank you in advance
>
I'm not sure torque deals with this how you are expecting it to.

There is Criteria.addDate() which doesn't cater for times.  Otherwise, 
format the current time as a String and use the regular 
Criteria.add(column, String, comparison) method.

Scott

-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au



---------------------------------------------------------------------
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