• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Need help with Hibernate Query language - timestamp field

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.



 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic