Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-15321

XWQL "in element()" expression creates exception with DBStringListProperty classes

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 9.11
    • Fix Version/s: 10.5-rc-1
    • Component/s: Query
    • Labels:
      None
    • Tests:
      Unit
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Pull Request Status:
      Pull Request accepted
    • Similar issues:

      Description

      Steps to REPRODUCE

      1. Login as Admin
      2. Edit the Help.Application.Movies class and enable the "Relational Storage" of the Genre (staticList1) property
      3. Execute this XWQL query: 
        select doc.fullName from Document as doc, doc.object(Help.Applications.Movies.Code.MoviesClass) as obj where doc.fullName not like '%Template' and 'drama' member of obj.staticList1
        

        You can either generate it with the Query Generator extension or by editing a page and adding this velocity code:

        {{velocity}}
        $services.query.hql("select doc.fullName from Document as doc, doc.object(Help.Applications.Movies.Code.MoviesClass) as obj where doc.fullName not like '%Template' and 'drama' member of obj.staticList1").execute()
        {{/velocity}}
        

       

      Expected results

      Only one result is being returned like this:

      Actual results

      Two results:

      Analysis

      Happen since the fix for XWIKI-15250.
      The previous XWQL query is translated to this HQL query:

       select doc.fullName from com.xpn.xwiki.doc.XWikiDocument as doc , com.xpn.xwiki.objects.BaseObject as obj , com.xpn.xwiki.objects.DBStringListProperty as obj_staticList11 join obj_staticList11.list obj_staticList11list where ( doc.fullName not like '%Template' and 'drama' in elements( obj_staticList11.list ) ) and doc.fullName=obj.name and obj.className='Help.Applications.Movies.Code.MoviesClass' and obj_staticList11.id.id=obj.id and obj_staticList11.id.name='staticList1' 
      

      The issue comes from the

      'drama' in elements( obj_staticList11.list )
      

      which generates (in SQL) another 'join' of the 'obj_staticList11.list'. It should be replaced by:

      'drama' in (obj_staticList11list)
      

      or

      obj_staticList11list = 'drama'
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                atallahade Adel Atallah
                Reporter:
                atallahade Adel Atallah
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Date of First Response: