Hi Michael,
Your changes looks good.
thanks!
Chris
----- Original Message -----
From: "Michael Bouschen" <Michael.Bouschen_at_Sun.COM>
To: <persistence_at_glassfish.dev.java.net>
Sent: Monday, March 26, 2007 10:15 AM
Subject: Re: JPQL: fix invalid SQL for COUNT on joined variablehip
> Hi Tom, hi Chris,
>
> attached you find an updated version of my fix. Chris proposed to use
> the old code that generates a COUNT(*) with a an EXISTS subquery in case
> of a COUNT(DISTINCT o) where the class of the variable o has a composite
> PK and the variable o is defined as inner join. Now my code throws an
> exception only if the variable is defined in a OUTER JOIN and the class
> has a composite PK and COUNT DISTINCT is used. Please have a look.
>
> Thanks!
>
> Regards Michael
>
>> Hi Tom,
>>
>> attached you find my fix for issue 2497 "JPQL: Invalid SQL for COUNT
>> on joined variable"
>> (https://glassfish.dev.java.net/issues/show_bug.cgi?id=2497). It
>> changes the generated SQL for queries such as:
>> SELECT c.name, COUNT(o) FROM Customer c LEFT JOIN c.orders o GROUP BY
>> c.name
>>
>> My change fixes the issue if the class of the joined variable has a
>> single PK or if it is not a COUNT(DISTINCT o). It does not cover the
>> case of a COUNT(DISTINCT o) where the class of the variable o has a
>> composite PK. I propose I checkin the fix, resolve issue 2497 and file
>> a new P4 issue for the remaining case from above.
>>
>> You find the fix and new test cases attached. Please have a look.
>>
>> Thanks!
>>
>> Regards Michael
>
>