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

Property API: unable to use eq() and in() methods for toMany relationships

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.2.M1
    • None
    • None

    Description

      Following code won't compile as eq() (as well as in()) method require List<Paintings> or other Property<> in this case, but everything else down the stack will correctly translate and execute this query and return correct result (I've checked this by simply allowing Object as argument in eq())

                      
          Painting painting = ObjectSelect.query(Painting.class).selectFirst(context);
          Artist artist = ObjectSelect.query(Artist.class)
                  .where(Artist.PAINTING_ARRAY.eq(painting))
                  .selectFirst(context);
      

      Generated SQL:

      SELECT DISTINCT t0.ARTIST_NAME, t0.DATE_OF_BIRTH, t0.ARTIST_ID 
      FROM ARTIST t0 
      JOIN PAINTING t1 ON (t0.ARTIST_ID = t1.ARTIST_ID) 
      WHERE t1.PAINTING_ID = ? 
      LIMIT 1 OFFSET 0 
      [bind: 1->PAINTING_ID:1]
      

      Workaround can be parsing expression from string:
      .where(ExpressionFactory.exp("paintingArray = $p", painting))

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment