I have a table (in Oracle 9 and up) where I need to find all entries for a given day using Hibernate. The entries have timestamps (with data type 'date'). Some of the entries have a time, others only have a date. This can not be changed, as this is the output of other applications which I can not change. In SQL I would write something along the lines of
SELECT * FROM table WHERE trim(table.date) = to_date('11.06.2009')
to get all entries for the date I am looking for. I was wondering how I can get Hibernate to do this using HQL. I know I can use SQL-queries in Hibernate, but this seems to be less clean. Is there a way to do this? If possible, this way should also work on non-oracle databases where timestamp would be the data type.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…