Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Veletin's Cheet Sheets

 
Bharat Ruparel
Ranch Hand
Posts: 493
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May be I am missing something, but why do the container callback methods such as ejbActivate, ejbPassivate, ejbRemove, ejbsetSessionContext, etc. are shown to throw both RemoteException, and EJBException? Head First EJB expressly advises against allowing the container callbacks to throw both Remote And EJB exceptions.
May be I am not reading the cheet-sheets right?
Will appreciate somebody clarifying this.
Thanks.
Bharat
[ December 22, 2003: Message edited by: Bharat Ruparel ]
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer is simply because my cheat sheets reflect what stands in the EJB 2.0 specification and J2EE 1.3 APIs. The reason why both exceptions are included in the method declarators is simply to ensure backward compatibility with previous EJB specification.
If you go in the API you will see the following:

java.rmi.RemoteException - This exception is defined in the method signature to provide backward compatibility for applications written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception.

I hope this clears your doubts
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic