If I have to user HQL, how to compare date ? In the coding below, it works. I convert Date to String, then using MySQL date_format function to compare it. It works, but it lose portability.
In the HQL , not using Criteria, how to make it work ?
Thanks.
Code:
String hql = "select * from data.Case todo where date_format(todo.createDate, '%m/%d/%Y') = :createDate";
Date today = new Date();
List tmp = this.getHibernateTemplate().findByNamedParam(hql, new String[] {"createDate" },
new Object[] { DateUtil.getDateStr(today) });