I am studying for the SCBCD exam and I would appreciate if someone is able to shed some light on a puzzling aspect of the specification....
According to HFEJB and the spec, within the ejbCreate method of a stateless session bean, you should be able to get a reference to your EJBObject through the SessionContext. How is this possible?
It seems to contradict the lifecycle of a stateless session, which states that the constructor, setSessionContext and ejbCreate are called by the container at a completely independent time from a call by the client, and are taken from the pool only to service a business method call, then put back immediatly after. This would seem to indicate that the bean is only connetced to an EJBOBject at the time the client calls a business method, and could be linked to a different EJBObject each time it is pulled from the pool.
So, as the ejbCreate method is only called once, at bean creation, (unlike entity beans), I can't understand how the SessionContext can have a reference to an EJBObject???
It should be something like connection pool. J2EE server implementation is done in order to store live references of EJB objects in somewhere and passing it when it is required. This is not an impossible task. And also we don�t need to worry about this as far as we are not going to implement a J2EE server.