• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate: Selecting date rows for a whole day when the DB dates are down to minutes

 
David Rocks
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is there a way to solve this problem?

I have a table which holds Games and these have a date coloumn that is down to the minute.

I would like to put in a date object into the search but it only has day, month and year set. I want it to pick up all the objects stored that are in that day despite the minutes.

Is there a way to do this in hibernate, some method I can use? here is my code, many thanks for any help.

 
Omar Al Kababji
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
may be i got you wrong ... anyway just compare you dates using greater that > and less than <

from YourEntity en where :d1 > en.startDate and :d2 < en.endDate

and then set your parameters, its should work in the same way as SQL queries work.
 
David Rocks
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that is probably the best way to go.

Wondered if hibernate had any clever ways to go about it. not an expert on it's full features.

I have just added on a day to give me upper and lower and that seems to be working

Cheers
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic