It's pretty well established that the current version of EJB-QL cannot do much outside of dealing with primitive types (and, it can't sort on Date at all).
What I'm looking for is a strategy to solve the following problem:
I have a WeatherReading Entity bean, with a persistent field IssuanceTime (of type java.util.Date). I have several thousand of these entries, and I'd like to have a function (in EJBQL/JBossQL) that retrieves the latest weather reading issued prior to a Date parameter. (I'm currently storing this in PostgreSQL using the timestamp datatype).
What are my options here? Do I have to convert everything to milliseconds and back?