db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amit Rana" <r...@solis.jp>
Subject RE: comparing timestamp
Date Wed, 15 Oct 2003 01:55:08 GMT
Thanks Vitali,
	That solved the problem.
Regards,
Amit.

> -----Original Message-----
> From: Usselmann, Vitali [mailto:Usselmann@elkware.com]
> Sent: Tuesday, September 30, 2003 6:53 PM
> To: 'Apache Torque Users List'
> Subject: AW: comparing timestamp
> 
> 
> 
> Hi,
> 
> the TIMESTAMP type in mysql gets auto updated everytime
> you touch that row. See: http://www.mysql.com/doc/en/DATETIME.html
> 
> If you do not want that behaviour, you need to change one line
> the  generation template in
>  <torque>\templates\sql\base\mysql\db.props
> 
> I changed
>   TIMESTAMP = TIMESTAMP
> to
>   TIMESTAMP = DATETIME
> 
> Afterwards you need to rebuild you objects.
> I hope this helps.
> 
> regards, Vitali
> 
> 
> -----Urspr√ľngliche Nachricht-----
> Von: Amit Rana [mailto:rana@solis.jp]
> Gesendet: Dienstag, 30. September 2003 07:53
> An: torque-user@db.apache.org
> Betreff: comparing timestamp
> 
> 
> Hi,
> 
> 	I am having problem in writing a query based on dates. I have
> following table
> <table name="TBL_ORDERS">
> 	<column name="orderCreatedDate" type="TIMESTAMP"
> required="true"/>
> 	<!--other columns removed-->
> </table>
> In mysql-
> CREATE TABLE TBL_ORDERS
> (
> 	orderCreatedDate TIMESTAMP NOT NULL
> );
> 
> 	I want to select records which lie between specified dates or
> greater than a particular date. I tried following but none of these
> work?
> 1. criteria.addDate(TblOrdersPeer.ORDERCREATEDDATE, year,month,day,
> Criteria.GREATER_THAN);
> this results in: FROM TBL_ORDERS WHERE
> TBL_ORDERS.ORDERCREATEDDATE>'20031029000000'
> 
> 2. criteria.add(TblOrdersPeer.ORDERCREATEDDATE,(Object) "2003/09/30" ,
> Criteria.GREATER_THAN);
> this results in: FROM TBL_ORDERS WHERE
> TBL_ORDERS.ORDERCREATEDDATE>'9/30/2003'
> 
> Date in the DB is: 9/30/2003 2:27:27 PM, I used following to set the
> date
> order.setOrdercreateddate(new Date(System.currentTimeMillis()));
> 
> Am I missing something obvious? Please advice how can I get this to
> work? I want to search orders based on dates.
> 
> Regards,
> Amit.
> 
> 
> ---------------------------------------------------------------------
> 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