• Post Reply Bookmark Topic Watch Topic
  • New Topic

what is Lazy Loading .how does it apply to EJB in general

 
Amar Naik
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
plz
help me in knowing this concept

thnks in advance
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When a bean is looked up through a finder method, there is no reason to load all the CMP attributes before it is returned to the caller. The CMP attributes are loaded only when the client invokes the method on the component interface.
 
Edward Kenworthy
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:
When a bean is looked up through a finder method, there is no reason to load all the CMP attributes before it is returned to the caller. The CMP attributes are loaded only when the client invokes the method on the component interface.

Or less trivially, it's where you only load related entities as you need them. In a worse case scenario (and we once blew-up a WLS instance like this) you might load half the database as a result of instantiating a single EJB entity because there were so many relationships. Aloowing that to happen is inefficient as it's unlikely you'd actually need to access all of the related objects, so you implement a lazy loading scheme instead so that instances are only instantiated off the db if and when they are needed. We implemented our scheme using BMP and a persistence manager class for each entity and relationship. A trivial undertaking once we'd written the base classes that did almost all the work, all the concrete classes did was provide a set of SQL strings (the usual CRUD).
Hope this helps.
Edward
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!