• 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

HFE + removeException() p.550

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

In HFE p.550, it is said hat you always can throw a RemoveException from your ejbRemove() method in case of stateless session bean (even if the client will never see it).

To my sense, because the ejbRemove() method from SessionBean interface doesn't declare the javax.ejb.RemoveException (application exception), you are NEVER allowed to throw a RemoveException in a SessionBean's ejbRemove() method, either a stateless or stateful one.

So to my sense, You only may prevent removal from entity beans because the ejbRemove() method of EntityBean precisely declares javax.ejb.RemoveException...

Am I correct here?

Thanks for your responses,
Cyril.
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm, interesting. Good catch.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've given this a bit thought and can't think why you would want to prevent the deletion of a stateful session bean. A client creates the session and so it would be a bit strange if there was code to prevent it being deleted in the bean class. As the instance can only be used to service that one client which it was created by and no others.

A container might want to prevent the deletion say, if the bean was using BMT and the client was in the middle of a transaction. That's the only reason I could think of that a stateful session bean might not be deleted.

Is my thinking correct?
 
reply
    Bookmark Topic Watch Topic
  • New Topic