Not swallowing exceptions in some cases when a tx is rolled back by Envers

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18028 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Adam Warski 2009-11-24 09:19:47 +00:00
parent 5b6a8eee07
commit 9d5f0d084a
1 changed files with 9 additions and 2 deletions

View File

@ -168,8 +168,15 @@ public class AuditSync implements Synchronization {
} }
} catch (RuntimeException e) { } catch (RuntimeException e) {
// Rolling back the transaction in case of any exceptions // Rolling back the transaction in case of any exceptions
session.getTransaction().rollback(); //noinspection finally
throw e; try {
if (session.getTransaction().isActive()) {
session.getTransaction().rollback();
}
} finally {
//noinspection ThrowFromFinallyBlock
throw e;
}
} }
} }