Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-2208

SQLTemplate: LEFT JOIN to a subset of a table returns nulls for entries that don't have a match in the subset

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.0.M3
    • Fix Version/s: 4.0.B1
    • Component/s: None
    • Labels:
      None

      Description

      I have a query:

      SELECT *
      FROM table1 t1
      LEFT JOIN (SELECT * FROM table2 WHERE <some condition>) t2
      	ON (<join by several columns>)
      

      Let's say I have:

      • 6 entries in table1
      • 4 entries in table2 that satisfy the WHERE condition

      In Java I do the following:

      SQLTemplate query = new SQLTemplate(Table1.class, <query from above>);
      <set params for WHERE condition>
      List<Table1> rows = (List<Table1>) context.performQuery(query);
      

      rows has 6 elements and contains 4 matching entries and 2 nulls

      Database is MySQL 5.6.22-log Community Server (GPL)

        Attachments

          Activity

            People

            • Assignee:
              ntimofeev Nikita Timofeev
              Reporter:
              atomashpolskiy Andrei Tomashpolskiy
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: