Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Stateless Session Beans ejbCreate and ejbRemove

 
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
 
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?
 
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
 
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
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic