Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » JPA - How to use AVG while computing Calendar date.time differences
JPA - How to use AVG while computing Calendar date.time differences [message #387380] Sat, 25 April 2009 04:14
Kenneth Unpingco is currently offline Kenneth UnpingcoFriend
Messages: 4
Registered: July 2009
Junior Member
Hello,

I am new to EclipseLink and to JPA. I wanted to ask how should I use JPA's
AVG (average) for computing the average time total between two Calendar
objects (response.date.time subtracted to request.date.time)? The Calendar
dates are gotten from a Docstore table having a modDate column.

Example:
In my EJB entity bean called AddressProcess.java, here is a snippet of the
code:
@NamedQuery(name = "AddressProcess.getAverageTimeForAddressesByDate",
query = "select AVG(res.modDate.time.time - req.modDate.time.time) from
AddressProcess as o JOIN o.requestDoc as req JOIN o.responseDoc as res
WHERE o.modDate BETWEEN :startDate AND :endDate")

I ran the program but I got a run-time exception error:
Exception Description: Syntax error parsing the query
[AddressProcess.getAverageTimeForAddressesByDate: select AVG(res.modDate -
req.modDate) from AddressProcess as o JOIN o.requestDoc as req JOIN
o.responseDoc as res WHERE o.modDate BETWEEN :startDate AND :endDate],
line 1, column 23: syntax error at [-].


Any recommendations/advice is greatly appreciated.

Thank you,
Ken U.
Previous Topic:Why is a child of a OneToMany relation not updated? (works with TopLink)
Next Topic:SDO in OSGi environment
Goto Forum:
  


Current Time: Sat Jan 18 12:08:20 GMT 2025

Powered by FUDForum. Page generated in 0.03493 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top