• 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

Lazy Loading

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am searching for a sample implementation of lazy loading in bmp entity beans.My Application requires that part of the entity bean be loaded when a particular API1 is called and the full details when API2 is called.I want to use the same entity bean for both the calls.Could some one help me out....
thanks.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Say you had a customer index file that registered what products were owned by customers, and a whole set of product files that had product details, like what color and size and other options they ordered.

The first call to create a new product from database data might not read the database at all. It builds an empty shell of a product object. The second call to getOwner() might read the customer index to populate owner fields. And the last call to getSize() might read the product file to populate product fields.
I'm makin this up as I go, so it's not a great looking example. But you get the idea that it may be expensive to get some of the data so we only fetch the data if a client asks for it.
Thinking about it, I've seen something like this with browsing. Maybe you only have to display customer name and product type in the browse products window. You could build Product objects with only this much data. Then when the user selects one product from the list and you want to show all the details, the Product object would know to fetch the rest of the data.
Any of that help?
 
reply
    Bookmark Topic Watch Topic
  • New Topic