wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Need help with Hibernate Query language - timestamp field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Need help with Hibernate Query language - timestamp field " Watch "Need help with Hibernate Query language - timestamp field " New topic
Author

Need help with Hibernate Query language - timestamp field

dhanya kairali
Greenhorn

Joined: Dec 28, 2000
Posts: 22
Hi,

I have a timestamp field in DB. I want to fetch those rows in DB whose timestamp falls between 2 dates.
I have tried this
select fe from ForwardEntry fe
where fe.myTxTs>=:startDate
and fe.myTxTs<=:endDate

If the time stamp falls on 12/12/2005 05:00 am I want that to be displayed when I specify my start and end date as 12/12/2005. This is not working cos the time field is not matching. How can I format the timestamp field in the query so that the date part alone is considered?

Thanks in advance,
Dhanya
Thomas Bigbee
Ranch Hand

Joined: Nov 29, 2001
Posts: 48
I would be more that happy to help, however, please note that I am a Hibernate Newbie myself. The below code works against a MySQL DataBase, the field on_date in the database is really a TimeStamp field, I know I should have named it on_timestamp, however, it works and I'm just too damn lazy to rewrite the code and database, also please be kind when reviewing the code, this may not be production grade, but at least it works.



 
jQuery in Action, 2nd edition
 
subject: Need help with Hibernate Query language - timestamp field
 
Similar Threads
gps week/seconds conversion
Oracle Timestamps and java.
Problem inserting a date into postgres
Hibernate DB2 convert Timestamp to Date ?
oracle date format