I have a MySQL table with a column type Date. In my hibernate mapping file I have mapped this column to java.util.Date. Now, while trying to retrieve results using criteria api based on date equality, I do not get any results if I set the Date using new Date(). If I normalize the date by setting hours, minutes and seconds to zero I get results.
I posted this question in stackoverflow.com(
http://stackoverflow.com/questions/1819 ... l-and-date) and got a solution in which I was asked to map the column to java.sql.Date and it works. But, I am curious as to why it does not work with java.util.Date even while querying since the column is of type Date and not Datetime?
If I change the mapping to java.sql.Date is there something I should keep in mind since this piece has been running in production for the past 2 years.