Within my method with @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
there can sometimes happen a org.eclipse.persistence.exceptions.DatabaseException
due to an SQLException
. I catch this exception and handle the situation by another database query. However, this query does not get through, as due to the exception, setRollbackOnly is automatically set and I am unable to commit the transaction any more at this point.
In Java SE I'd do an explicit
manager.getTransaction().rollback();
manager.getTransaction().begin();
but within the application server this is not working of course.
Can I somehow get my database changes to commit in this situation?