Implementing aggregate boolean functions in JPQL? [message #533496] |
Fri, 14 May 2010 05:28  |
Eclipse User |
|
|
|
Hi,
I'm trying to implement the equivalent of an aggregate boolean AND function. The following query is based on pure SQL ideas taken from this article and although it shows what I'm trying to achieve, it's not valid JPQL:
SELECT
NEW BookingSummaryDto( b.id, b.bookingReference, SUM(i.price), MIN(CASE WHEN i.paid THEN 1 ELSE 0 END) )
FROM
Booking AS b JOIN b.items AS i
GROUP BY
b.id, i.bookingReference
The other methods described in the article don't appear to be possible with JPQL either as they involve sub-queries in the from clause.
Can anyone suggest a way to achieve this in JPQL?
Thanks,
Dean
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03763 seconds