Help with database list classes

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Help with database list classes

Robin Fernandes
Hi all,

I'd like a property in a class to represent a list of all users, plus
an "unknown" option so that the field can be left "blank" if required.

I can get the list of users with the hibernate query:
select prop.value from BaseObject as obj, StringProperty as prop
       where obj.className='XWiki.XWikiUsers'
             and prop.id.id = obj.id
             and prop.id.name='fullname'
       order by prop.value

But don't know how (or if it's possible) to modify the query to append
an extra static value like "unknown".
I would rather not create a dummy user to represent this value, and if
I can avoid creating a separate dummy class and object to hold the
value that would be good too.

If the list class could understand velocity arrayLists rather than the
hibernate query, I could do something like:
### Select all users: ###
#set($query = "select prop.value from BaseObject as obj,
StringProperty as prop where obj.className='XWiki.XWikiUsers' and
prop.id.id = obj.id and prop.id.name='fullname' order by prop.value")
#set($users = $xwiki.search($query))
### append an extra value: ###
#$users.add("(unknown)")

Is there a way to modify the hibernate query to achieve the same
effect directly in the class editor?

Thanks,
Robin.



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws