persistence@glassfish.java.net

Re: [Fwd: Question about EJBQL HAVING clause requirements]

From: Linda DeMichiel <Linda.Demichiel_at_Sun.COM>
Date: Thu, 16 Feb 2006 09:35:40 -0800

Hi Michael,

Sorry, I thought I had replied. We should stick
with the standard SQL semantics, which is how the spec
is currently worded.

thanks!

Linda



Michael Bouschen wrote:

> 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
>
>
> ------------------------------------------------------------------------
>
> Subject:
> Question about EJBQL HAVING clause requirements
> From:
> Michael Bouschen <Michael.Bouschen_at_sun.com>
> Date:
> Tue, 17 Jan 2006 15:55:54 +0100
> To:
> Linda DeMichiel <Linda.Demichiel_at_sun.com>, Mike Keith
> <michael.keith_at_oracle.com>
>
> To:
> Linda DeMichiel <Linda.Demichiel_at_sun.com>, Mike Keith
> <michael.keith_at_oracle.com>
> CC:
> "persistence_at_glassfish.dev.java.net" <persistence_at_glassfish.dev.java.net>
>
>
> 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
>