The moose likes EJB and other Java EE Technologies and the fly likes Pagination Best Practices Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Pagination Best Practices" Watch "Pagination Best Practices" New topic
Author

Pagination Best Practices

Justin Krettabull
Greenhorn

Joined: Sep 08, 2004
Posts: 26
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
Ken Loh
Ranch Hand

Joined: Feb 16, 2005
Posts: 190
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pagination Best Practices