Originally posted by Kev Miller:
Hi,
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)?
Thanks,
Kev
...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]
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
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.
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
permaculture is a more symbiotic relationship with nature so I can be even lazier. Read tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|