3 Replies Latest reply on Oct 3, 2007 1:41 PM by Matt Drees

    limiting size of query/result set

    Phil Haigh Novice


      I'm trying to create a query to return me 3 random rows from a table. Obviously, I can set up my query like this:

      <framework:entity-query name="randomPageImagesSmall">
       <framework:ejbql>from PageImage</framework:ejbql>

      and then just take the first 3 records.. but what I'd like to do is just return 3 rows (i.e. analagous to SQL: LIMIT 3), as this saves reading the whole lot from the DB..

      any advice greatly appreciated.