This content has been marked as final.
Show 3 replies
-
1. Re: limiting size of query/result set
trickyvail Oct 3, 2007 10:57 AM (in response to pdhaigh)Could you try this?
<framework:entity-query name="randomPageImagesSmall" max-results="3" > <framework:ejbql>from PageImage</framework:ejbql> <framework:order>RAND()</framework:order> </framework:entity-query>
-
2. Re: limiting size of query/result set
pdhaigh Oct 3, 2007 11:05 AM (in response to pdhaigh)ah excellent, thanks.
It doesn't really matter, but I noticed that this actually translates to LIMIT <maxResults+1>:<framework:entity-query name="randomPageImagesSmall" max-results="3" > <framework:ejbql>from PageImage</framework:ejbql> <framework:order>RAND()</framework:order> </framework:entity-query>
=order by rand() limit 4
-
3. Re: limiting size of query/result set
matt.drees Oct 3, 2007 1:41 PM (in response to pdhaigh)It does that so that, if you're doing paging, you can tell if there's a next page or not (which is a cute trick, by the way). The getResultList() method will only have 3 results.