Need help with Hibernate Query language - timestamp field
posted 11 years ago
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
posted 10 years ago
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.