This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests and have Scott Selikoff and Jeanne Boyarsky on-line!
See this thread for details.
Win a copy of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests this week in the OCP 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

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

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic