Database List property doesn't work anymore with 9.11.2 (regression)

Hello,

I have a velocity app based upon forms with xwiki class stuff but on xwiki 8.4.6 it doesn’t work anymore since 9.11.2 upgrade:

  • I have forms issue
  • and custom livetable issue too

First, about my forms issue:
I have a FormSMQ.EAClass with properties:

  • DG MOA: Database List
    • Name and pretty name filled
    • Display Type: select
    • Sort: id
    • XWiki Class Name: FormSMQ.ListeDGClass This Class store my DG values that the forms must displayed in edit mode (to select an entry)
    • Id Field Name : DGLib
    • Value Field Name: DGLib

My entries are store in FormSMQ.ListeDGTemplate a class template with FormSMQ.ListeDGClass object.
FormSMQ.ListeDGClass:

  • DG Id (DGId: String)
  • DG Lib (DGLib: String)

Here a screenshot of FormSMQ.ListeDGTemplate to show values to display in my form:

Since xwiki 9.11.2, my select list of FormSMQ.EAClass is not filled anymore…
I mean that my FormSMQ.EATemplate didn’t show values in my “DG MOA” Database List property when I edit my form.

Maybe: Loading... ?

Thxs for you help.

Pascal B

Here a new posts to displayed my tests (I will update it):

  • same issue DB list KO with:

    • xwiki 9.8 RC1 jetty package
    • xwiki 9.8 jetty package
    • xwiki 9.9 jetty package
    • xwiki 9.11.2
  • No issue with

    • 9.7 jetty package
    • 8.4.5
    • 8.4.6

Regression since xwiki 9.8RC1, then…

Maybe?

This may break existing applications if they use Database List properties and the last author of the class that holds the property definition doesn't have sufficient rights.
but I’m Admin xwiki user and my class saved with admin user … :confused:

I think the issue is simply caused by bad naming. When you create a class named FormSMQ.ListeDGClass the naming convention we have is that:

  • FormSMQ.ListeDGTemplate is the class template, copied when creating new pages of type FormSMQ.ListeDGClass
  • FormSMQ.ListeDGTemplate is the class sheet, used to display pages of type FormSMQ.ListeDGClass

Queries for pages of type FormSMQ.ListeDGClass usually exclude the template FormSMQ.ListeDGTemplate because you want to see the actual instances of the class (that were created using the template). For instance a query for blog posts will exclude the Blog.BlogPostTemplate page.

The Database List property has two modes:

  • the implicit mode: you specify the class name, the id and the label fields. The database query is generated for you
  • the explicit mode: you write your own database query, so you have full control over the query

In the implicit mode, since you have very limited control over the generated query you can’t exclude the class template (which is needed most of the time) so the query generator does it for you.

In the explicit mode it’s up to you to exclude, if you want, the class template, since you control the query.

So in your case, if you want to use the implicit mode then you shouldn’t use the FormSMQ.ListeDGTemplate page name for something that is not the template of FormSMQ.ListeDGClass. Your FormSMQ.ListeDGTemplate is more a collection of allowed FormSMQ.ListeDGClass instances, so I would name it differently.

Hope this helps,
Marius

First thxs to help me :slight_smile:

You mean FormSMQ.ListeDGSheet is the class sheet, used to display pages of type FormSMQ.ListeDGClass ?

I use the implicit mode. I quickly try your solution and it seem that DB list work better.
I must going further in my tests anyway to be sure.

Do you mean that you exclude xxxtemplate from dblist results since 8.4rc1? because my app worked fine with xwiki 6 to 8.4.6.

Right.

Since 9.8RC1 (as you found Loading... ), but I see it as a bug fix not a regression. Before that the template was listed and you had no way to exclude it (with the implicit mode).