Hi All, Is it possible to get a referene to EJBObject (using SessionContext) in ejbCreate and ejbRemove for a stateless session bean?
I think the answer should be NO. When container creates a bunch of stateless session beans in a pool (without any client asking for it) there are no EJBObjects associated so what will getEJBObject() return?
I had the same question when I read HFEJB chpater on session life cycle. I beleive the book says you should be able to get EJBObject during ejbCreate() and ejbRemoval(). I havent cross verified at other sources or their errata.
I think when the container creates a bunch of stateless session beans it will not call the ejbCreate method.
when a client calls create method on the homeObject then the container creates an ejbObject and returns the reference to the client.
next time when client calls any business method on the ejbObject then the container picks up one of the bean from the pool and executes ejbCreate method on this bean. During this process ejbObject created before (second step )is associated to the stateless session bean.
Hi Naresh, In that case there should not have any difference between stateless and stateful session bean. In the scenario that you have described, the bean should then also get the client security information since ejbcreate is called only after client invokes a business method. Devendra