The figure 6 shows that, while creating a Session Object, the client invoked the create on EJB(Local)Home and then the "EJB (local)Home calls new on the EJB(local) Object". From what I understood was, the client calls create on EJB(local)Home and then the home calls it on the instance of the bean. So the EJB(local)Object is no where coming in between. I understand that the create "RETURNS" an EJB (local)Object....
My ques is, Does EJB(local) Home "CALLS" EJB(local)Object while creating a session Object???. That's what the diagram shows. The Home only "RETURNS" the EJB Object.
Or, am I misunderstanding the OID diagram??
Joined: Aug 26, 2001
What the diagram shows is that when a client invokes create on a EJB(Local)Home of a stateful session bean, the home first creates a new EJB(Local)Object, then a new instance of the session bean class on which it sets the context and finally it initializes the newly created session bean by invoking ejbCreate() on it.
This process is described in section 7.6 of the EJB spec which states:
A [stateful] session bean instance�s life starts when a client invokes a create<METHOD>(...) method on the session bean�s home interface. This causes the container to invoke newInstance() on the session bean class to create a new session bean instance. Next, the container calls setSessionContext() and ejbCreate<METHOD>(...) on the instance and returns the session object reference to the client. The instance is now in the method ready state.