Guillaume, That worked! Thanks a lot for the help. Yet, I still don't understand why the HQL string below does not yield the correct results: $query = "select obj from BaseObject obj where obj.className='Contacts.ContactClass'" Can someone explain how XWiki traverses documents and objects to generate the resultset when executing HQL statements? Thanks. On 15/04/2008, Guillaume Lerouge <[email protected]> wrote:
Hi Tjaart,
Unfortunately removing the select part does not help and I get the same
error.
It is hard to believe that few people have managed to construct a query for all object of the same class. I though this would be straight forward.
I want to retrieve a list of object from a specified class and then print all their attributes.
Most people simply copy/paste the standard query and it works fine for them ;-)
#set ($query = ", BaseObject as obj where obj.name=doc.fullName and obj.className='Contacts.ContactClass' and obj.name<>'Contacts.ContactClassTemplate' order by doc.date desc")
#set($results=$xwiki.searchDocuments($query, 10, 1)) #foreach($item in $results)
#set ($itemdoc = $xwiki.getDocument($item))
#set ($itemobject = $itemdoc.getObject('Contacts.ContactClass'))
$itemdoc.display('firstname') | $itemdoc.display('lastname') | $itemdoc.display('phone1') <br />
#end
Guillaume
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users