|
|
|
@ -16,6 +16,8 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.transaction.support; |
|
|
|
package org.springframework.transaction.support; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.UndeclaredThrowableException; |
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
import org.apache.commons.logging.LogFactory; |
|
|
|
import org.apache.commons.logging.LogFactory; |
|
|
|
|
|
|
|
|
|
|
|
@ -123,7 +125,7 @@ public class TransactionTemplate extends DefaultTransactionDefinition |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
TransactionStatus status = this.transactionManager.getTransaction(this); |
|
|
|
TransactionStatus status = this.transactionManager.getTransaction(this); |
|
|
|
T result = null; |
|
|
|
T result; |
|
|
|
try { |
|
|
|
try { |
|
|
|
result = action.doInTransaction(status); |
|
|
|
result = action.doInTransaction(status); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -137,6 +139,11 @@ public class TransactionTemplate extends DefaultTransactionDefinition |
|
|
|
rollbackOnException(status, err); |
|
|
|
rollbackOnException(status, err); |
|
|
|
throw err; |
|
|
|
throw err; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception ex) { |
|
|
|
|
|
|
|
// Transactional code threw unexpected exception -> rollback
|
|
|
|
|
|
|
|
rollbackOnException(status, ex); |
|
|
|
|
|
|
|
throw new UndeclaredThrowableException(ex, "TransactionCallback threw undeclared checked exception"); |
|
|
|
|
|
|
|
} |
|
|
|
this.transactionManager.commit(status); |
|
|
|
this.transactionManager.commit(status); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|