[jboss-user] [JBoss Seam] - limiting size of query/result set

pdhaigh do-not-reply at jboss.com
Wed Oct 3 10:14:24 EDT 2007


Hi,

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>
  | 		<framework:order>RAND()</framework:order>
  | 	</framework:entity-query>	

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.

cheers

phil

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4091074#4091074

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4091074



More information about the jboss-user mailing list