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

ColumnSelect: Property.self() translates into wrong SQL code

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.0.B2, 4.1.M1
    • Fix Version/s: 4.0.RC1, 4.1.M1
    • Component/s: Core Library
    • Labels:
      None

      Description

      In some cases column query with "self" property can be translated into wrong SQL.

      In particular following code:

      ObjectSelect.columnQuery(Artist.class, 
                      Artist.PAINTING_ARRAY.dot(Painting.PAINTING_TITLE),
                      Property.createSelf(Artist.class)).select(context);
      

      Translates into this SQL:

      SELECT 
          DISTINCT t1.PAINTING_TITLE, 
          t1.ARTIST_NAME, t1.DATE_OF_BIRTH, t1.ARTIST_ID 
      FROM ARTIST t0 
      JOIN PAINTING t1 ON (t0.ARTIST_ID = t1.ARTIST_ID)
      

      Here is wrong t1 alias used for Artist property. Note that changing order of columns leads to correct query.

        Attachments

          Activity

            People

            • Assignee:
              ntimofeev Nikita Timofeev
              Reporter:
              ntimofeev Nikita Timofeev
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: