• 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

Why do bean classes need access to homes and objects

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Spec makes a big deal about which of the lifecycle and container callback methods of a bean class can call (getEJBHome, getEJBObject, getEJBLocalHome, getEJBLocalObject) methods on their corresponding contexts(SessionContext, EntityContext or MessageDrivenContext). I do not understand why a bean class instance would need to access its home and component interfaces? Would anyony who has any idea/example of this, please share it?

Thanks
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure about the following, but this is what came to my mind:

  • If you want to create another bean of the same type from within the bean class (I don't know why would you wanna do that! ). You have to do it using the home interface by calling the getEJBHome() method.
  • If you want to pass a reference of the bean to another bean, you can't pass this as a parameter. You're only allowed to pass your bean's EJBObject.


  • Regards,
    [ July 12, 2005: Message edited by: Nadeem Awad ]
     
    Greenhorn
    Posts: 1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I also think that the getEJBHome can be used as a cached object. Then when you want to get the bean object again sometime later. In this way, you save a lot of resource to lookup the ejbHome object.
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    reply
      Bookmark Topic Watch Topic
    • New Topic