I spent a couple of days delving into this. The root of the problem seems to be that the hibernate-generated grammar does not include support for temporary literals.
The JPA specification includes support for temporary literals, but does not require persistence providers to translate from JPA syntax to native JDBC driver syntax. From JPA2 Spec 4.6.1:
"The JDBC escape syntax can be used to specify date, time, and time literals. For example:
SELECT o FROM Customer c JOIN c.orders o WHERE c.name = 'Smith' AND o.submissionDate < {d '2008-12-31'}
The portability of this syntax for date, time, and time stamp literature depends on the JDBC driver used. Resiliency providers do not need to translate from this syntax into their own database or driver syntax. "
It would be nice if Hibernate provided support for literary dates, but it seems that the implementation of this is slightly more related to what I suspected.
The functionality that is missing here regarding my needs is that you cannot execute the select coalesce(somePath, someDateLiteral)
. You can still do where somePath=someDate
. As long as they display objects, you can drop whatever you want into the where clause.
source share