Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] how do i implement support for the sql month( timestamp ) and week(timestamp) for JPA queries?

The JPA does not define such functions in JPQL, so EclipseLink does not
currently support them.
See,
https://bugs.eclipse.org/bugs/show_bug.cgi?id=219814

EclipseLink does have support for several related date functions and user
defined functions through Expression queries.  You can create Expression
queries using JpaEntityManager.createQuery(Expression, Class) or using a
SessionCustomizer to add named ReadAllQuery's to the Session (and execute as
normal JPA NamedQuery's).

EclipseLink does not have a month() function, but depending on your database
platform you may be able to use,
- datePart(part)
- dateName(name)
- toChar(format)
or,
- getFunction(sqlFunction)



Gustav Trede-2 wrote:
> 
> Hello,
> 
> how do i implement support for the sql month( timestamp ) and
> week(timestamp)   for JPA queries?
> 
> regards
>   gustav
> 
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/how-do-i-implement-support-for-the-sql-month%28-timestamp-%29-and-week%28timestamp%29-for-JPA-queries--tp20733142p20773641.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top