Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / October 2007

Tip: Looking for answers? Try searching our database.

date operations in jpql queries

Thread view: 
jasiu85 - 15 Oct 2007 14:33 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.