Database List property sort issue

Hello,

I have issue with Database List property on document Class: DocMyClass.
In DocMyClass there I use this property:

my property:
  Name:  MyProperty
  Display type: Select
  Sort: id
  Id Field Name : Id_SI
  Value Field Name : Lib_SI

Values of Database List are:

Id_SI              Lib_SI
01_Value           My nice first value
01_Value           Another one
01_Value           Again
...
99_Value           My last value

My new document contains Objets de type DocMyClass (1); MyProperty

Ok, when I edit my new document I want a custom a select type sort list then I use Sort= Id_SI but I want that my new doc store the label (Lib_SI) because I want to use it in a live table with a search field: type: text and match: partial.
Unfortunaly, the search field of live table use “Id Field Name” to filter documents!
(note: I tried autosuggest search field … but match:partial doesn’t work)

Of course I change “Id Field Name” to “Lib_SI” but then the sort in my select form field is wrong (because I want to use a custom sort). Sort: — or none doesn’t work (no changes: Id Field is still used to sort select entries).

How can I do to use a custom sort in my select field?
Thxs

Pascal B

Hum, I think I must use hibernate query field in my DocMyClass, but I didn’t manage to find the query.
I’m stuck with:

select distinct Lib_SI from BaseObject as obj, DBListProperty as prop join prop.list as Lib_SI where obj.className='Catalogue.Code.Listes.ListeSIClass' and obj.id=prop.id.id and prop.id.name='Lib_SI'

I think I must replace “DBListProperty” by somethink like “DBDataListProperty” but I didn’t found documentation except: https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/Scripting/velocityHqlExamples/#H2AProperty28StringProperty2CIntegerProperty2Cetc29

Non-exhaustive list of queryable Object Fields
The full list of available fields can be found in the Hibernate mapping files (*.hbm.xml), which can be found inside WEB-INF/lib/xwiki-core-x.y.jar (where x.y is the XWiki version).

Anyways I’m looking for a query to list all values of DocMyClass:

Lib_SI (sorted by Id_SI)
My nice first value
Another one
Again
...
My last value

OK I found my query:

select prop.value from BaseObject obj, StringProperty prop, StringProperty as propId_MOA where obj.className='Catalogue.Code.Listes.ListeMOAClass' and prop.id.id=obj.id and prop.name='Lib_MOA' and obj.id=propId_MOA.id.id and propId_MOA.id.name='Id_MOA' order by propId_MOA.value asc

I set “hibernate query” in MyClass …
I must check if standard user could use it

Then I add my query example to list all objects properties value (and a link to more hql query examples) on doc: Add a query example to list all objects properties value (and a link to more hql query examples): https://extensions.xwiki.org/xwiki/bin/view/Extension/Query%20Module#HQueryLanguageExamples

Maybe on this page, we can add links to :