Exception Handling
EJB3 provides two types of exceptions that can be used to model exceptions in enterprise applications. These are system exceptions and application exceptions.
System exceptions are the exceptions that indicate an error with the application required services like database connections, network connections…etc. System exceptions are presented by the class EJBException, which is inherited from the Exception RuntimeException which means you don’t need to declare the exception as throwable in the method signature.
System exceptions cause the EJB transactions to roll back.
Application exceptions are the exceptions that indicate an error with the provided data to the EJB methods like invalid customer age, user cart is empty…etc. Application exceptions are custom exceptions that are coded by the developer and not presented in the EE framework.