Thank you Thomas,
I'll try.
Regards,Julio

      De: Thomas Mortagne <[email protected]>
 Para: XWiki Users <[email protected]> 
 Enviadas: Quarta-feira, 13 de Julho de 2016 2:56
 Assunto: Re: [xwiki-users] hql query returning objects?
   
On Tue, Jul 12, 2016 at 7:03 PM, dullfig <[email protected]> wrote:
> Hello:
>
> I have a problem. I created an XClass with personal info (name, address
> etc); but instead of attaching one XObject to many pages (1 to 1), I have
> attached many objects of the same class to one single page (an array of
> xobjects if you will). Is it possible to query the xobjects for a particular
> name, and have the query return an xobject, instead of the name of the page?
> the name of the page does me no good, because I still have to search through
> the objects...
>
> doing:
>
> #set( $hql =  "select obj.name from BaseObject obj where obj.className =
> '$class.name'" )
>
> returns a list containing the same page over and over, instead of a list of
> xobjects.
>
> Can this be done?

You can't directly get an XObject from a hql request but you can get
enough information to get the object from the document.
obj.name is indeed the name of the page, you already know the class
name so what is missing for you is the obj.number.

Then you can do

$xwiki.getDocument($name).getObject($classs.name, $number)

>
>
> Dan
>
>
>
> --
> View this message in context: 
> http://xwiki.475771.n2.nabble.com/hql-query-returning-objects-tp7600307.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users



-- 
Thomas Mortagne
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users


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

Reply via email to