• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Pagination Best Practices

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic