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.
i think i clarified your dought.
let me know if i am correct.
posted 13 years ago
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
Quick! Before anybody notices! Cover it up with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop