It is often too expensive to use EntityBeans for pagination especially when the number of records are large. Users are likely to use only the first few pages.
A good explanation on the above could be found in the
Value-list Handler pattern.
A readily available Value-list Handler could be found at
here.
For my case, I'm using CachedRowSet which I can preset the page size, not unlike the Value-list handler. Its jar is downloadable from Sun for both jdk1.4.x and jdk1.5 .
Originally posted by Justin Krettabull:
I'm new to EJB and I'm wondering what the best practices are for implementing pagination.
For example, say I have an Entity Bean called InventoryBean. The InventoryBean has a relation to a ProductBean using a method called getProducts(). The getProducts() method returns a Collection of ProductBeans.
The getProducts() method will return approximately 100 ProductBeans, but I only want to display 10 at-a-time on the jsp page.
What is the best way to implement this using a pure CMP approach in EJB2.0?
thanks for all your help,
Justin
[ April 06, 2005: Message edited by: Ken Loh ]