persistence@glassfish.java.net

[Fwd: Question about EJBQL HAVING clause requirements]

From: Michael Bouschen <Michael.Bouschen_at_Sun.COM>
Date: Thu, 16 Feb 2006 15:46:55 +0100

Hi Linda, hi Mike,

any thoughts about allowing aggregate functions over arbitrary fields in
the EJBQL HAVING clause? I haven't heard anything back.

Regards Michael


attached mail follows:



Hi Linda, hi Mike,

the PFD version of the spec restricts the HAVING clause to grouping
items or aggregate functions applying to grouping items. Would it make
sense to allow aggregate functions over arbitrary fields (especially
non-grouping fields) in the HAVING clause? Today the following EJBQL
query is invalid. It groups employees by their department, but retains
only those departments where the average salary is greater than a
certain limit:
   SELECT e.department FROM Employee e
   GROUP BY e.department HAVING AVG(e.salary) > :limit

Regards Michael