[jboss-user] [EJB 3.0] - Treating a long as a Date within EJB QL?

EricJava do-not-reply at jboss.com
Wed Oct 31 18:02:34 EDT 2007


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?


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4100875#4100875

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4100875



More information about the jboss-user mailing list