- Posted by: Marcus Eriksson
- Posted on: February 23 2004 16:44 EST
How would you implement paging of large result sets for a web client?
The client is invoking (querying) a servlet invoking a stateless session bean that performs the database query. The result set is potentially very large and I want the client to be able to fetch parts of the result set (keep a cursor open). Any ideas?
The problem is how to keep the connection open on the server. A stateful session bean can be passivated and I would loose the cursor, right?
A somewhat related problem: Streaming of the result set all the way from the database to the client...
- web client paging large result set by j h on February 23 2004 17:24 EST
- Paging through large result sets by Sean Sullivan on February 23 2004 18:58 EST
- scrollable result set by Suma GS on March 02 2004 07:57 EST
- the first article is comprehensive and excellent by Balaji Ragu on July 15 2004 02:47 EDT
can you pull the full result set into the servlet, put it into the user's session context, then implement paging in the servlet, leaving the stateless session bean alone?
No that would obviously not work for really large result sets. However, I'm thinking about selecting only rowid/keys that way. Perhaps even keeping the result set on the client...
"Value List Handler" pattern:
article: ResultSet pagination using DB2, JDBC, and JSPs
DisplayTag (an open source JSP tag library)
The DisplayTag library provides tags for displaying large data sets.
The tag library supports: column display, sorting, paging,
cropping, grouping, exporting, and decoration.
Live demo @ http://www.displaytag.org/index.jsp
Sadly, none of the proposed patterns are perfect. To be a perfect solution we would need to keep the connection open. There are no real alternatives.
One of your proposed solutions may be good enought, though. I'll have to think about what our needs really are...
article: "Paging in J2EE: Manage Large Result Sets Efficiently"
Take a look at: http://valuelist.sourceforge.net
May be scrollable resultset would help here...
Paging in J2EE: Manage Large Result Sets Efficiently
jGuru: Paging with Scrollable ResultSets