• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why two interfaces that is home and component

 
Raj Kumar Bindal
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • 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??
 
wise owen
Ranch Hand
Posts: 2023
  • Mark post as helpful
  • send pies
  • 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
  • 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???
 
Balaji Anand
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • 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).
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • 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 ]
 
Patrick Williams
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic