This content has been marked as final.
Show 3 replies
-
1. Re: traversing through result
mazz Jan 29, 2008 12:10 PM (in response to gerch)Yours is a typical use-case for paging:
http://java.sun.com/javaee/5/docs/api/javax/persistence/Query.html
setFirstResults:
http://java.sun.com/javaee/5/docs/api/javax/persistence/Query.html#setFirstResult(int)
setMaxResults:
http://java.sun.com/javaee/5/docs/api/javax/persistence/Query.html#setMaxResults(int) -
2. Re: traversing through result
gerch Jan 29, 2008 12:34 PM (in response to gerch)ok i get the part of perhaps saying:
for (int i = 0; i < maxSize; i = i+ 10){ q.setFirstResult(i); q.setMaxResults(10); }
but how do i find out the max rows ? do i need to do a count statement before that ? -
3. Re: traversing through result
ragavgomatam Jan 30, 2008 11:44 AM (in response to gerch)setMaxResults(10);
here denotes how may rows you would like to handle at a time. Usually this is harcoded, got nothing to do with number of rows in table