• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to check for two dates equality in HQL ?

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
My Book domain object has an instance variable called releasingDate.
At Java level, this variable's type is java.util.Date and at Hibernate mapping file is date.
I tried the following query :

here is the implementation :

(yes, I'm using Spring, but the problem is related to Hibernate, I think).
In order to supply a date argument to this query, I wrote :

But I got an exception indicating the books's size is 0 , while I'm sure that I have two books.
Any ideas (how to compare two date for equality in hibernate) ?
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a quick browse, You need to remember that Date objects include their timestamp, meaning the minute, seconds etc. So you need to remove the time and just use the date if you want to compare on just a day, month and year.

Mark
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!