• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stateless Session Beans ejbCreate and ejbRemove

 
Devendra Inamdar
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

regards,
Devendra
 
Rahul Toaikani
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Anybody?
 
NareshAnkuskani Kumar
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Devendra Inamdar
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic