• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

Stateless Session Beans ejbCreate and ejbRemove

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
A magnificient life is loaded with tough challenges. En garde tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic