persistence@glassfish.java.net

Re: JPQL: fix invalid SQL SELECT clause for query joining the same relationship twice

From: Tom Ware <tom.ware_at_oracle.com>
Date: Mon, 23 Apr 2007 14:03:16 -0400

Hi Michael,

  The changes look good.

  Thanks for looking at this.

-Tom

Michael Bouschen wrote:

> Hi Tom,
>
> attached you find my fix for issue 2865 "JPQL: invalid SQL SELECT
> clause for query joining the same relationship twice":
> https://glassfish.dev.java.net/issues/show_bug.cgi?id=2867
>
> I changed method ExpressionQueryMechanism.extractStatementFromItem()
> as you proposed with a small update. I check for already cloned
> expressions before doing a rebuild of the expression, but only if it
> is *not* an ExpressionBuilder. With the original change I got a couple
> of test failures in entity-persistence-test, because a getSingleResult
> query returned more than one instance. The generated SQL included all
> the tables twice which caused the single instance being included
> multiple times in the query result.
>
> You find the fix and new test cases attached. Please have a look.
>
> Thanks!
>
> Regards Michael