Andrei Tomashpolskiy created CAY-2208:
-----------------------------------------

             Summary: SQLTemplate: LEFT JOIN to a subset of a table returns 
nulls for entries that don't have a match in the subset
                 Key: CAY-2208
                 URL: https://issues.apache.org/jira/browse/CAY-2208
             Project: Cayenne
          Issue Type: Bug
    Affects Versions: 4.0.M3
            Reporter: Andrei Tomashpolskiy


I have a query:
{code}
SELECT *
FROM table1 t1
LEFT JOIN (SELECT * FROM table2 WHERE <some condition>) t2
        ON (<join by several columns>)
{code}

Let's say I have:
- 6 entries in table1
- 4 entries in the subset of table2 that satisfy the WHERE condition

In Java I do the following:
{code}
SQLTemplate query = new SQLTemplate(Table1.class, <query from above>);
<set params for WHERE condition>
List<Table1> rows = (List<Table1>) context.performQuery(query);
{code}

*rows* has 6 elements and contains 4 matching entries and 2 _nulls_

Database is MySQL 5.6.22-log Community Server (GPL)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to