persistence@glassfish.java.net

Re: JPQL: fix query selecting JOIN variable

From: Tom Ware <tom.ware_at_oracle.com>
Date: Tue, 23 May 2006 16:59:20 -0400

Hi Michael,

  One comment: I would like to see a comment in ExistsNode that
explains why we are adding the ReportItems as non-fetch joined attributes.

  Other than that, it looks good.

-Tom

Michael Bouschen wrote:

>Hi Tom,
>
>attached you find my changes to fix the JPQL query compiler bug 638
> https://glassfish.dev.java.net/issues/show_bug.cgi?id=638
>A query selecting a JOIN identification variable defined for a single
>valued relationship field resulted in invalid SQL. It generated an outer
>join even if the identification variable was defined as inner join and
>the SQL outer joined the wrong side in the FK join clause.
>
>I removed adding an extra ExpressionBuilder for such an identification
>variable that was used when processing the SELECT clause. Now it
>directly uses the expression created for the path expression of the JOIN
> clause. Then we do not need the extra select expression cache in the
>GenerationContext anymore. I removed this too.
>
>The above also solves the problem of duplicated tables in the generated
>tables: https://glassfish.dev.java.net/issues/show_bug.cgi?id=197
>
>The jar JPQL-fix638-060523.jar includes the entity-persistence changes.
>The other jar adds a new test method to a query test class in
>entity-persistence-tests. I extended the JUnitDomainObjectComparer and
>added code to deal with nulls in the query result.
>
>Thanks!
>
>Regards Michael
>
>