• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic