Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » JPQL query date/datetime problem
JPQL query date/datetime problem [message #667490] Fri, 29 April 2011 02:50 Go to next message
Pavel Zelenka is currently offline Pavel Zelenka
Messages: 61
Registered: July 2009
Member
Hi,

in MySQL table there is a field which contains datetime value. I need to compare this to only date value. Is there any solution in JPQL or I need to use native query?

Thanks
Re: JPQL query date/datetime problem [message #667915 is a reply to message #667490] Mon, 02 May 2011 14:38 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

The JPQL spec does not provide any date conversion functions, but EclipseLink does provide a FUNC() JPQL function that allows usage of database function calls. The database function you use would be specific to your database, such as DATEPART().

EclipseLink Expressions also define several date functions not currently supported in JPQL.

You could also query that the date-time is between two Timestamp from 0 to midnight, this should be the same as checking the date only.


James : Wiki : Book : Blog : Twitter
Previous Topic:Avoiding N+One Selects and stale BatchValueHolders
Next Topic:Does flush() sync with the db or the L2 cache?
Goto Forum:
  


Current Time: Mon Sep 01 19:38:21 EDT 2014

Powered by FUDForum. Page generated in 0.01577 seconds