1

Can I get items created at specified hour (e.g. 9am) from the table using by hibernate restrictions (i mean ids 130, 146, 147, 148)?

enter image description here

Can you tell me how (createDate is in Calendar format in Java)?

gaffcz
  • 3,469
  • 14
  • 68
  • 108

1 Answers1

1

Does it have to be done using Restrictions? Can't you use something else? If yes then you should be able to do it with something like this:

Restrictions.sqlRestriction("DATEPART(hour,createDate) = 09")

Not sure about the 0 in 09 and didn't test it myself but don't see why it shouldn't work.

Mateusz Dymczyk
  • 14,969
  • 10
  • 59
  • 94