title: Server-side Pagination Patterns for Seam?
body: <p>I have an application based on JBoss Seam, RichFaces, and Hibernate/JPA.  I've created a DAO class and a couple of business-layer classes that are used to retrieve data based on various criteria.  (Fetch most recent, browse all, etc.)  I'd like to return these results and display them for the user, allowing the user to paginate through them.  However, since the objects returned can be rather large (and there is a large number of objects) I'd prefer not to use something like <code>&lt;rich:dataList /&gt;</code> and <code>&lt;rich:datascroller /&gt;</code> which would require me to retrieve all the objects in one large query and maintain them in memory.</p>
  
  <p>Are there any generally-accepted patterns for performing server-side pagination of datasets?  I'm looking for a strategy for:</p>
  
  <ul>
  <li>Retrieving a subset of my data using a start index and count</li>
  <li>Scroll through the dataset using 'next' and 'previous' buttons, thereby retrieving a new subset of the data using an updated start index and count</li>
  </ul>
  
  <p>Have any of you seen custom DataModel objects that would allow me to use <code>&lt;rich:dataList /&gt;</code> and <code>&lt;rich:datascroller /&gt;</code> but still perform server-side pagination using subset queries?  I'd be very curious to learn of your methodologies for handling such a scenario.</p>