I need to select some entities using HQL filtering by time. But I need to compare only date component without time. For example 1.1.2011 12.00 and 1.1.2011 13.20 must be equal.
What operator can I use?
@Query("FROM Item item " +
"WHERE item.date [equality by date operator] :date " )
List<Item> findByDate(@Param("date") Date date);
If you do not mind DB-specific functions, you’d be able to do this (using Oracle as an example).
You can use this because the OracleDialect registers
truncas aStandardSQLFunctionand Oracle’sTRUNCremoves the time component of a date.