• 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

ejbCreate(), create(), ejbRemove(), remove()

 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to figure out the difference between stateless and stateful session beans when it comes to ejbCreate() and ejbRemove().

If I understand it correctly:

1. When I call create() on a stateless EJB home, the container does not necessarily create a bean and calls ejbCreate() on it. Most chances are that it already has one available in the pool so what it does is find/create an EJB object, associate the bean to that EJB object, and hand me a reference to that EJB object.

2. When I call remove() on a stateless EJB object, the container does not necessarily call ejbRemove() on the bean associated with it and removes it from the container. Most chances are that it will just send the bean back to the pool and kill/cache the EJB object.

3. When I call create(parameters) on a stateful EJB home, the container does not necessarily create a bean. There are two options: it can either create a new bean, or passivate one for me. Either way, it will then unquestionably call ejbCreate(parameters) on it. This is very different from the stateless case, because even if the bean was not created but only passivated for me, ejbCreate(parameters) will still be called on it.
Then the container finds/creates an EJB object, associates the bean with that EJB object, and hands me a reference to that EJB object.

4. When I call remove() on a stateful EJB object, the container does not necessarily removes the bean associated with it. It can just send it to the pool without passivating anything. In this case the container will not call ejbRemove() on the bean.

Am I right?
[ June 12, 2007: Message edited by: Joseph Sweet ]
 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can nobody comment on this?

Come'on guys, drink some coffee and put your fingers to typing.

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic