• 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 two interfaces that is home and component

 
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand why we have 2 to go through 2 interfaces(home and component) to access a bean class.
**Does this exists to make difference between different kind of beans.
or any other reason???
plz clarify it??
 
Ranch Hand
Posts: 2023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can say that EJBHome is service factory for EJB objects.
 
Raj Kumar Bindal
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But,we are doing nothing through Home interface,just getting reference of component interface.
I am not clear why 2 interfaces???
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had the same question... When i hit... say the AdviceBean Home i am going to ultimately ask for a session object... so y cant the first call itself do everything internally and give me an Component interface?(let us ignore the casting and stuff for a while).
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm sure the answer you are looking for is here somewhere; search the forum or google the saloon.
Here's just one: What is purpose of homeObject?
(Of course these days I argue that the home interface has a Factory Method while EJBHome isn't an Abstract Factory: Patterns: Abstract Factory Vs Factory Method)
[ May 19, 2006: Message edited by: Peer Reynders ]
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EJB 2.0 does not want you to access the bean directly. If you could, you would not be able to take advantage of security (which is supplied by the container generated EJBObject) and object pooling. When you utilize the Home interface, you are essentially asking the container to create a new object or to grab one from the pool. This would be more difficult for the container (and container developers) if it allow for calling the bean itself. HTH
 
reply
    Bookmark Topic Watch Topic
  • New Topic