This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
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

Bean things can be done in ejbCreate() (stateless vs. stateful session bean)

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question when I was reading HFEJB book. Can any one explain why following two cases are different for accessing resource?

Based on page 196, for stateful session bean, we can access in ejbCreate()
- your special JNDI environment
- Another bean's methods
- a resource manager

However on page 228, for stateless session bean, we can only access access in ejbCreate()
- your special JNDI environment

Thanks!!
Forest Lynn
 
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stateful session beans are created only when the client calls the home.create() method. But in the case of stateless session beans, the beans can be created and pooled anytime by the container, even when there is no client. For example, a container may wish to create and plop some stateless session bean instances when it is starting up. By saying that there is no necessity on the container's part to make the EJB capable of accessing another bean's methods and resource managers in ejbCreate, the specification allows the container more freedom and flexibility to create the stateless session bean instances and run its ejbCreate() whenever it wants without worrying about giving the bean resource manager access ability etc. But the container can choose to give the bean access to resource managers and other beans even in the ejbCreate() of a stateless session bean, however the spec does not mandate it. It just allows the container to optimize the creation of the stateless session bean better. But there is no need to provide this flexibility to a stateful session bean creation as the container will create it only at a fixed time, when the client calls create on the home

hth
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic