• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Lazy Load in Entity Beans Relationship

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any way of saying to the container that I want a "lazy load" of entity beans in a relationship (like I can do in Hibernate)?

Tanks
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Entity Beans naturally are "lazy loaders". A CMR field holds a reference to a local component interface or a collection of local interfaces. The (related) entity itself is only loaded by the container once you invoke a business method through that local interface.

I anything, a vendor extension (not the spec) may allow you to specify eager-loads of entities that you will most likely need - as long as you can guarantee that the EJB Server is total control of that portion of the underlying persistent store - so that it doesn't waste time on unnecessary ejbLoads().
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Indeed, most application servers allow you to influence the loading strategy for entity beans that participate in relationships (via their local business interfaces). You can have lazy-loading (my guess this is a natural default, since it usually provides optimal performance when dealing with multiple relationships), and eager-loading . With eager-loading, use it as "full" (i.e. when a bean gets loaded, load all beans that participate in a relationship with the first bean, even indirectly) with caution, since it can easily generate a whole bunch of ejbLoad() calls and unnecessary bean instances (especially when we�re dealing with many-to-many or many-to-one relationships). Of course, the lazy-loading tradeoff is more computation during bean access. It is up to you to dig in the AS documentation and see what can and what can not be done and decide your strategy. Just remember that loading strategies and a number of other optimizations are beyond (i.e. not specified) in the ejb specification. That leaves room for the AS vendors to optimize and make us AS users happier (at least in theory)
 
today's feeble attempt to support the empire
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic