Hi there
After playing a while around with Hibernate, I have a few
issues. Apart from that, it's a quite nice and easy-to-use tool,
the code-compile-test cycle is much shorter than usual!
I have a class containing a
java.util.Date-Object, this
will be mapped to a
DATETIME on my MySQL DB (4.0.14).
(Hibernate 2.0.3, Java 1.4.2)
Now the problem is:
How can I compare 2 Dates ?
Quote:
Note: A Date shouldn't contain any Informations about the
current time, a Date consists only of Day, Month and Year.
Though, the java.util.Date Class contains informations
about the current time as well.
I tried it like:
Code:
session.find("from MyClass as myCls where cls.myDate = ?",
new Date(), Hibernate.DATE);
But this always returns
0 results... (Yes, I have a few entries
for todays date ;))
The problem is that also the times will be compared... How can I avoid
this behaviour, because I'm only interested in the Date (Year, Month,
Day) ? Is there an easy solution for MySQL, or do I something wrong ?
Thanks in advance
"L