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??
Joined: Feb 02, 2006
You can say that EJBHome is service factory for EJB objects.
Raj Kumar Bindal
Joined: Apr 15, 2006
But,we are doing nothing through Home interface,just getting reference of component interface. I am not clear why 2 interfaces???
Joined: Nov 03, 2004
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).
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