I want to pass a query like this to Hibernate3 HQL:
Code:
from abc where dateItem > '2008-11-04'
I realise that the reference way to do this is to used a named variable in the query and then set it from Java code, but I can't easily do that because the query text is ad-hoc, built from a Velocity template.
I also realise that HQL allows scalar functions that are supported by the underlying DB (Oracle's TO_DATE, for example), but I don't want to rely on that because I don't know what my underlying DB is going to be at runtime.
So, my question is: can a query containing some kind of date literal be expressed in HQL, and it will work regardless of the actual database?
Thanks for help