Hi all, I dont understand how we can get reference to EJBObject in ejbCreate method for a stateless session bean. From what I understand, the stateless session beans are created by the container (for this the bean constructor is called and then setSessionContext, ejbCreate methods are called) and kept in pool. Till this point the bean is tied only to the context and not to any EJBObject. If this is the case, how can we call getEJBObject in ejbCreate method ? Please respond if you know the answer.
This topic was already discussed in this forum a few days back. You may want to checkthis out.
Suman A Sarker<br />SCJP, SCWCD, SCBCD<br /> <br />If You Can't Beat Them ... Join Them!
posted 16 years ago
Thanks for your reply, Suman. The link you sent however did not clear my doubt. The link for the discussion you sent concludes that because getEJBObject() is possible in ejbCreate(), EJBObject should have been created before that. I could infer that while reading HFEJB. But, I am interested to know when (and how) EJBObject creation happens for stateless session bean in relation to ejbCreate(). If I have to go with the OID in page 227 of HFEJB ejbCreate is possible in a "different/unrelated" time. So it can happen before or after the "client call" create(). If it happens before the "client call". EJBObject would not have been created during ejbCreate().
Also, another related question is, if every client creates a new EJBObject, does it mean that ejbCreate is called for every client? I assume it is not. As a result, if ejbCreate can access EJBObject, which client's EJBObject are we talking about ?