[ 
https://issues.apache.org/jira/browse/OPENJPA-215?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard Zowalla resolved OPENJPA-215.
-------------------------------------
    Resolution: Fixed

Already fixed on master: OPENJPA-547 (50b81e6d7, on master) stopped adding a 
separate join for JJTINNERFETCHJOIN (JPQLExpressionBuilder.java:792-793) and 
forces an inner eager join for inner fetch paths 
(StoreCollectionFieldStrategy.java:187-190), so the duplicate TORDERITEM join 
is gone. Closing.

> unneeded left join SQL  for queries with  inner join fetch, related to issue 
> OPENJPA-134
> ----------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-215
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-215
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 0.9.6, 0.9.7, 1.0.0
>            Reporter: Catalina Wei
>            Priority: Major
>
> In verifying fixes for issue OPEN-134, found an outstanding problem. 
> Extra unneeded join generated for the following query with inner join fetch 
> while left join fetch generates correct SQL:
>     select o from Order o inner join fetch o.lineitems
> the generated SQL has an extra left join that causes the result set empty, I 
> will create a new JIRA issue for this problem:
> 1297 demo TRACE [main] openjpa.Query - Executing query: select o from Order o 
> inner join fetch o.lineitems
> 1297 demo TRACE [main] openjpa.jdbc.SQL - <t 1094861122, conn 1831234854> 
> executing prepstmnt 726281034 SELECT t0.oid, t0.version, t0.amount, 
> t0.customer_countryCode, t0.customer_id, t0.delivered, t2.order_oid, t2.lid, 
> t2.version, t2.cost, t2.part_partno, t2.quantity FROM TORDER t0 INNER JOIN 
> TORDERITEM t1 ON t0.oid = t1.order_oid LEFT OUTER JOIN TORDERITEM t2 ON 
> t0.oid = t2.order_oid ORDER BY t2.order_oid ASC FOR READ ONLY 
> Abe,
> I have verified this fix with EagerFetchMode parallel and join. However, 
> there is an outstanding problem for the following query with inner join fetch 
> while left join fetch generates correct SQL:
>     select o from Order o inner join fetch o.lineitems
> the generated SQL has an extra left join that causes the result set empty, I 
> will create a new JIRA issue for this problem:
> 1297 demo TRACE [main] openjpa.Query - Executing query: select o from Order o 
> inner join fetch o.lineitems
> 1297 demo TRACE [main] openjpa.jdbc.SQL - <t 1094861122, conn 1831234854> 
> executing prepstmnt 726281034 SELECT t0.oid, t0.version, t0.amount, 
> t0.customer_countryCode, t0.customer_id, t0.delivered, t2.order_oid, t2.lid, 
> t2.version, t2.cost, t2.part_partno, t2.quantity FROM TORDER t0 INNER JOIN 
> TORDERITEM t1 ON t0.oid = t1.order_oid LEFT OUTER JOIN TORDERITEM t2 ON 
> t0.oid = t2.order_oid ORDER BY t2.order_oid ASC FOR READ ONLY 



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to