GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  J2EE  >  EJB

 Print  |  
Question:  How do you throw EJB/SQL exceptions to front-end/presentation layer ?



March 03, 2008 13:00:11 #1
 santanu_nandi   Member Since: March 2008    Total Comments: 1 

RE: How do you throw EJB/SQL exceptions to front-end/presentation layer ?
 
Inside the EJB code you put a try catch block. Inside the catch block you throw new EJBException. In the method signature also you declare that the method will thow the exception and not handle it.

At the client side(assuming there is a Front-end/presentation layer), you put the code which invokes an EJB business method inside try catch block and here there will be a matching RemoteException handler. Within the  RemoteException handler you can handle the Exception.
     

 

Back To Question