Hi,
I have two questions regarding JPQL and operations on dates and times:
1)
I have a table where I store datetime intervals, like this: (dt_start,
dt_end). I want to find all intervals that contain given date, i.e.
those for which following inequality holds: dt_start <= given_date AND
given_date < dt_end. How to write such query in JPQL?
2)
How can I add some seconds to a date in JPQL? Can I build an
expression like that?
I'm using MySQL and I can write those queries in its SQL, so I could
use native queries, but I'd like to stick to JPQL, if possible.
Regards,
Mike
simas - 19 Oct 2007 13:55 GMT
Hi Mike,
you need a local variable of type Date holding the date you wish to
compare with the value in the Database.
See it as comparing two Date objects.
Simon