Originally posted by Kev Miller:
on page 227 (Head First EJB) it says that ejbCreate is invoked by the container without a client request. On the following page, however, it says that you can get a reference to your EJBObject from within ejbCreate. How can you get such a reference when the container invokes ejbCreate without any client request? Isn't an EJBObject instance only created when the client invokes create on his home object stub (whereas the EJBObject instance is not linked to an actual bean instance until a business method call)?
...it says that you can get a reference to your EJBObject from within ejbCreate. How can you get such a reference when the container invokes ejbCreate without any client request?
It means you as a bean developer can get a reference to the EJBObject[/QB]
However, the container handles the create and remove calls without necessarily creating and removing an EJB instance".
So we can access the EJBObject in the ejbCreate() of the Stateless Session bean.
that the container will pull a bean instance from the pool and associate the instance with its SessionContext and EJBObject by invoking the bean's setSessionContext() and ejbCreate() methods.
The OID both HFEJB page : 227 and in spec Page : 92 suggest that the new EJBObject is created when the "client" calls create method of Home interface. So by this diagram one can come to a conclusion that during ejbCreate() of stateless session bean we cannot get access to EJBObject, because it will be created only when the client calls create() method.