@@ -54,8 +54,8 @@ public class ArangoTransactionManager extends AbstractPlatformTransactionManager
5454 public ArangoTransactionManager (ArangoOperations operations , QueryTransactionBridge bridge ) {
5555 this .operations = operations ;
5656 this .bridge = bridge ;
57- super . setGlobalRollbackOnParticipationFailure (true );
58- super . setTransactionSynchronization (SYNCHRONIZATION_ON_ACTUAL_TRANSACTION );
57+ setGlobalRollbackOnParticipationFailure (true );
58+ setTransactionSynchronization (SYNCHRONIZATION_ON_ACTUAL_TRANSACTION );
5959 }
6060
6161 /**
@@ -126,10 +126,21 @@ protected void doCommit(DefaultTransactionStatus status) throws TransactionExcep
126126 }
127127 try {
128128 tx .commit ();
129+ afterCompletion ();
129130 } catch (ArangoDBException error ) {
131+ if (!isRollbackOnCommitFailure ()) {
132+ try {
133+ tx .rollback ();
134+ } catch (ArangoDBException noRollback ) {
135+ if (logger .isDebugEnabled ()) {
136+ logger .debug ("Cannot rollback after commit " + tx , noRollback );
137+ }
138+ // expose commit exception instead
139+ } finally {
140+ afterCompletion ();
141+ }
142+ }
130143 throw new TransactionSystemException ("Cannot commit transaction " + tx , error );
131- } finally {
132- bridge .clearCurrentTransaction ();
133144 }
134145 }
135146
@@ -151,7 +162,7 @@ protected void doRollback(DefaultTransactionStatus status) throws TransactionExc
151162 } catch (ArangoDBException error ) {
152163 throw new TransactionSystemException ("Cannot roll back transaction " + tx , error );
153164 } finally {
154- bridge . clearCurrentTransaction ();
165+ afterCompletion ();
155166 }
156167 }
157168
@@ -203,13 +214,8 @@ protected void prepareSynchronization(DefaultTransactionStatus status, Transacti
203214 }
204215 }
205216
206- /**
207- * Unbind the holder from the last transaction completed.
208- *
209- * @see ArangoTransactionHolder
210- */
211- @ Override
212- protected void doCleanupAfterCompletion (Object transaction ) {
217+ private void afterCompletion () {
218+ bridge .clearCurrentTransaction ();
213219 TransactionSynchronizationManager .unbindResource (operations .getDatabaseName ());
214220 }
215221}
0 commit comments