Hi all,
I am trying to convert a sql query into hql, and in the original sql query, it has the where condition like "where cast(convert(varchar,created_on,112) as datetime) between ? and ?...."
basically, the idea is to compare the date without considering the time differrence, e.g.
in db created_on is 2010-06-30 12:12:12, and what I want is 2010-060-30 00:00:00.
what I did is replace the question marks with ":date1" and ":date2",but it fails to execute the hql, with the exception that "org.hibernate.QueryException: cast() requires two arguments " But it is quite likely hibernate doesn't support this convert() function. does anyone know some better way on how to convert this query?
Thanks in advance!
|