0 Replies Latest reply on Oct 31, 2007 6:02 PM by Eric H

    Treating a long as a Date within EJB QL?

    Eric H Novice

      Background: Moments in time are best stored as number of miliseconds from the start of epoch. That's what we do in our DB. All time values are stored as 64-bit integers, and creating java.util.Date s from these is easy: new Date(l).

      Now comes the question: how do I handle this in EJB QL queries?

      In particular, I would like to do queries like, "show me the total value of all the invoices by month for the last twelve months, with reference to the East Coast timezone".

      I can easily do this by doing multiple queries: create a Calendar object, set a timezone, find the first and last instants of a month, do a query for that, and do all this in a for loop.

      Any other ways?