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

XWQL issue with class names containing an underscore

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 7.2-rc-1, 7.1.3
    • 7.1.1
    • Old Core, Query
    • None
    • High
    • Easy
    • N/A
    • N/A

    Description

      Classes with an underscore in their name won't let you run XWQL queries with object properties clauses.

      Steps to reproduce:

      1. Create a class 'XWiki.Speaker_Class'
      2. Add a static list attribute 'country' to it. Specify a list of values such as: 'fr|uk|cn|ja'
      3. Create a page 'Main.JohnDoe', add an XWiki.Speaker_Class object to it, select 'uk' from the country list
      4. Create a page 'Main.UkSpeakers' and add the following Velocity script to it:
        {{velocity}}
        #set($xwql = "from doc.object(XWiki.Speaker_Class) as xobj where xobj.country='uk'")
        #set($results = $services.query.xwql($xwql).execute())
        $results
        {{/velocity}}
        

      The following error is then raised, while the same steps without the underscore in the class name return the expected result.

      org.hibernate.QueryException: could not resolve property: country of: com.xpn.xwiki.objects.BaseObject [ select doc.fullName from com.xpn.xwiki.doc.XWikiDocument as doc , com.xpn.xwiki.objects.BaseObject as xobj where ( xobj.country = 'uk' ) and doc.fullName=xobj.name and xobj.className='XWiki.Speaker_Class' ]
      

      The issue was reproduced against the XWiki playground, version 7.1.1. Note that the HQL transposition of the query returns the expected results.

      Attachments

        Activity

          People

            mflorea Marius Dumitru Florea
            slauriere slauriere
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 1 hour
                1h