Hello,
I have an issue with my HQL, I need to perform a query on a table with a dateTime field.
I need to return rows of records between two Datetimes specified. The problems is that the Java Date object (which contains a time value) is being translated into a date with the year and month only, time is not included in the query.
What do I need to do to include the time of the date object in my query value?
Any help would be greatly appreciated :)
Hibernate Code in JAVA
Code:
return DataAccessUtils.intResult(hibernateTemplate.find("SELECT COUNT(*) FROM Activitylog WHERE activityCode = ? AND (date between ? AND ? )", new Object[]{event,dateFrom, dateTo}));
Final SQL output in MYSQL log
Code:
SELECT count(*) as col_0_0_ from Activitylog activitylo0_ where activityCode='U_LOG_IN' and (date between '2010-08-19' and '2010-08-19')