Letting the presentation layer (JSF) handle business exceptions from service layer (EJB)
Create a custom service layer specific runtime exception which is annotated with @ApplicationException with rollback=true. @ApplicationException(rollback=true) public abstract class ServiceException extends RuntimeException {} Create some concrete subclasses for general business exceptions, such as constraint violation, required entity, and of course optimistic lock. public class DuplicateEntityException extends ServiceException {} public class EntityNotFoundException extends ServiceException {} public … Read more