It was Jan Kodera who posted Nov 25, 2007; 06:34pm:
Hi All,
i want use database list class as property in my class. I tried
hibernate query to fill in values of property. After this, the
select box was empty.
I think there is no problem in query (Select doc from XWikiDocument
as doc) and I filled in value ( doc.name) and id (doc.id) and also
i filled in which class should hibernate use. (XWikiDocument). I
dont know, what I am doing wrong. Is there some tutorial for this?
(found, with a
partial answer on Nabble:
http://www.nabble.com/Database-List-Class-td13937776.html)
I also wanted to have this... namely... to be able to list all the
values of the property prop of each object.
I tried, running XWiki 1.1.2.5797:
- for a property fromList, of type database-list-class
- I tried leaving all to default except adding class-name
XWiki.MyClass, id-field-name xId and value-field-name xValue
- then tried to create an object using the default sheet: this gave a
hibernate exception, namely, that a comma is too much before the from
(the whole query is provided in the log)
- I re-edited the class, removed class and fields and replaced by the
query with the query removed:
select idprop.value,valueprop.value from
com.xpn.xwiki.doc.XWikiDocument as doc,
com.xpn.xwiki.objects.BaseObject as obj,
com.xpn.xwiki.objects.StringProperty as idprop,
com.xpn.xwiki.objects.StringProperty as valueprop where
doc.fullName=obj.name and obj.className='XWiki.MyClass' and
obj.id=idprop.id.id and idprop.id.name='xId' and
obj.id=valueprop.id.id and valueprop.id.name='xValue'
and that worked!
Boy... that was convoluted but this seems to be a very very very
precious feature of XWiki which I would like to write a readme about.
Is there an issue reported about this ?
And, indeed, as Sergiu and Brandon indicate in the answer of the mail
above, it is highly non-trivial to understand that there's an
alternative between class,id,value and query. So I would also suggest
to write this in the page (as simple text).
paul
PS: I only saw answers of Brandon and Sergiu, was there other?