ouch! It works.
Yes,  it is not related directly with XWiki however, in any case, I updated
the documentation of the query module to help other newbies like me =)

Danilo



2014-07-17 18:22 GMT-03:00 Sergiu Dumitriu <[email protected]>:

> Combine
>
> http://stackoverflow.com/questions/4414964/how-to-get-list-of-10-random-unique-objects-with-hibernate
> with
>
> http://stackoverflow.com/questions/580639/how-to-randomly-select-rows-in-sql
>
> I.e. append "order by xxx()", where xxx is what the database you're
> using knows.
>
> rand() seems to work for both mysql and hsqldb.
>
> On 07/17/2014 04:54 PM, Danilo Oliveira wrote:
> > Hello XWiki Devs,
> >
> > I have a specific class in the XWiki (TestClass) with more than 50 items.
> > However I would like to retrieve, through the HQL statement, just 5
> random
> >  results.
> >
> > I know how to set the limit, using the "setlimit", however I don't know
> and
> > I did not find if there is a way to retrieve a random result.
> >
> > Is it possible, or I will need to make a hql that returns all results and
> >  after that take  5 itens randomly?
> >
> > Thanks
> >
>
>
> --
> Sergiu Dumitriu
> http://purl.org/net/sergiu
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>



-- 
Danilo Amaral de Oliveira
Engenheiro de Computação
celular (32) 9111 - 6867
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to