Find all objects of a class (more than one object on a page)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Find all objects of a class (more than one object on a page)

Jean Couteau
Dear all,

I am a bit lost with hql requests.

What I would like to do is find all the objects of Space.MyClass (even
if there are more than one object on a page).

I tried to play with

#set ($sql = ", BaseObject as obj where obj.name=doc.fullName and
obj.className='Space.MyClass'")

and then

#foreach ($item in $xwiki.searchDocuments($sql))

to display the results.

But the only thing i can get is the documents.

Is there a searchObjects method or something like that ?

Any hint or solution ?

Jean

--
----
Jean Couteau
Code Lutin - http://www.codelutin.com
44 Bd des Pas Enchantés - 44230 St-Sébastien/Loire
Tél : 02 40 50 29 28 - Fax : 09 59 92 29 28

_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Find all objects of a class (more than one object on a page)

Marius Dumitru Florea
Hi,

See the javadoc for Document here http://tinyurl.com/9hxpot . Pay
attention especially to getObject* methods. For each document retrieved
with your HQL query you can call getObjects("Space.MyClass").

Hope this helps,
Marius

Jean Couteau wrote:

> Dear all,
>
> I am a bit lost with hql requests.
>
> What I would like to do is find all the objects of Space.MyClass (even
> if there are more than one object on a page).
>
> I tried to play with
>
> #set ($sql = ", BaseObject as obj where obj.name=doc.fullName and
> obj.className='Space.MyClass'")
>
> and then
>
> #foreach ($item in $xwiki.searchDocuments($sql))
>
> to display the results.
>
> But the only thing i can get is the documents.
>
> Is there a searchObjects method or something like that ?
>
> Any hint or solution ?
>
> Jean
>
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Find all objects of a class (more than one object on a page)

Jean Couteau
Thanks for the hint, I did not try the getObjects method but getObject.
Problem solved.

Marius Dumitru Florea a écrit :

> Hi,
>
> See the javadoc for Document here http://tinyurl.com/9hxpot . Pay
> attention especially to getObject* methods. For each document retrieved
> with your HQL query you can call getObjects("Space.MyClass").
>
> Hope this helps,
> Marius
>
> Jean Couteau wrote:
>  
>> Dear all,
>>
>> I am a bit lost with hql requests.
>>
>> What I would like to do is find all the objects of Space.MyClass (even
>> if there are more than one object on a page).
>>
>> I tried to play with
>>
>> #set ($sql = ", BaseObject as obj where obj.name=doc.fullName and
>> obj.className='Space.MyClass'")
>>
>> and then
>>
>> #foreach ($item in $xwiki.searchDocuments($sql))
>>
>> to display the results.
>>
>> But the only thing i can get is the documents.
>>
>> Is there a searchObjects method or something like that ?
>>
>> Any hint or solution ?
>>
>> Jean
>>
>>    
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/users
>
>  


--
----
Jean Couteau
Code Lutin - http://www.codelutin.com
44 Bd des Pas Enchantés - 44230 St-Sébastien/Loire
Tél : 02 40 50 29 28 - Fax : 09 59 92 29 28

_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users