There are following way to Handle Exceptions in Java.
Business Exceptions :-
Business exceptions inherit from EmployeeApplicationBusinessException, which in turn is an EmployeeApplicationException. Business exceptions are checked exceptions. They are require a MessageCode at instantiation time. Optionally, you may pass message parameters, a uniqueId, and the triggering Throwable object. You should always create a dedicated subclass for each business exception.
You are not supposed to instantiate an EmployeeApplicationBusinessException object directly, but should use one of its subclasses.
Example :- we are rollback the transaction if any exception is occurred.
Technical Exceptions :-
Technical exceptions inherit from EmployeeApplicationRuntimeException, which in turn is a EmployeeApplicationException. They are unchecked exceptions. They require a MessageCode at instantiation time. Optionally, you may pass parameters, and the triggering Throwable object. Technical components should model each error state through a dedicated subclass.
A technical components always includes dedicated technical exception classes.
Example :- set the return code to error value, log the exception.