Catch the exception in JPA transactions