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, 0.9.8
            Reporter: Catalina Wei


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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to