EJBs are a component of enterprise applications which are usually based on distributed environment. So, separately from the standard exceptions that can occur, there can be exceptions like statement failure, security permissions, server down, etc.
EJB container considers exceptions in two ways −
When Application Exception occurs, EJB container intercepts the exception, but precedes the same to the client as it is. It does not roll back the operation unless it is particular in the code by EJBContext.setRollBackOnly () method. EJB Container does not wrap the exception in case of Application Exception.
When System Exception occurs, EJB container intercepts the exception, rollbacks the contract and start the clean up tasks. It wraps the exception into Remote Exception and throws it to the client.
Application exceptions are commonly thrown in Session EJB methods as these are the methods responsible to execute business logic. Application exception should be stated in throws clause of business scheme and should be thrown in case business logic fails.
System exception can happen at any time like naming lookup fails, sol error occurs while attractive data. In such a case, such exception should be wrapped under EJBException and thrown back to the client.
At client side, handle the EJBException.
EJB(Enterprise JavaBeans) Related Interview Questions
|J2EE Interview Questions||Core Java Interview Questions|
|JDBC Interview Questions||JSP Interview Questions|
|Android Interview Questions||JMS(Java Message Service) Interview Questions|
|JavaServer Faces (JSF) Interview Questions||Java collections framework Interview Questions|
|Java 8 Interview Questions||Java Collections Interview Questions|
|Java Exception Handling Interview Questions||Java Concurrency Interview Questions|
|Java Serialization Interview Questions||Java Programmer Interview Questions|
|Java Inheritance Interview Questions||Java IO Interview Questions|
|Object Oriented Programming in PHP Interview Questions|
Ejb(enterprise Javabeans) Tutorial
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.