• Post Reply Bookmark Topic Watch Topic
  • New Topic

Stateless Session Bean should it be container managed or a Bean managed  RSS feed

 
Mukesh Poddar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

All..... My question is for using the statless container managed Is there is any need to call the ejbRemove() method will it be explicitly called for the Conatainer managed Bean Once after creating an instance of it.

What happens Should i call the ejbRemove() method every time i create an instance for an Bean Managed EJB to return the instance to the pool or it will be the same as with the Container managed EJB


Mukesh
 
Damanjit Kaur
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose your question is relating to using CMP or BMP in stateless session Beans and not whether stateless session bean should be BMT or CMT.

calling remove() for both CMP or BMP will delete record in database, however in BMP you write the sql to delete the record while in CMP you don't have to.

in both BMP and CMP you need to call remove() to delete the record and after that the bean instance is sent to pool.
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to EJBs, so could someone please explain to me why a stateless session bean would be either BMP or CMP? The P stands for persistence, right? What's there to persist in a stateless session bean? Or even a stateful one for that matter - the "state" is similar to the session attribute scope, isn't it?
 
Balaji Anand
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
if u call ejbRemove() it has no effect on stateless session bean... after each business call the bean automatically returns to the pool... so no use in calling it and the container wont bother.

in stateful session... ur call to ejbRemove() results in the execution of the code there(like resource release) and the bean getting destroyed... so u do need to call ejbRemove() for the stateless beans.

The CMP and BMP of entity bean is entirely different from this... there calling ejbRemove() results in the deletion of the entity in the underlying data store.

Hope this helps
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!