1
爲什麼交易在沒有Exception
的情況下回滾?該對象未被保存。 我已經定義了交易參數,如:Spring transactionManager正在回滾,而testexception = [null]!
@Transactional(value = "transactionManager", timeout = 30, rollbackFor =
java.lang.Exception.class)`.
這就是日誌說的交易。
org.springframework.test.context.transaction.TransactionalTestExecutionListener
endTransaction
INFO: Rolled back transaction after test execution for test context [[email protected]
testClass = DAOTest, testInstance = [email protected], testMethod =
[email protected], testException = [null], mergedContextConfiguration =
[[email protected] testClass = DAOTest, locations =
'{classpath:/applicationcontext.xml}', classes = '{}', contextInitializerClasses = '[]',
activeProfiles = '{}', contextLoader =
'org.springframework.test.context.support.DelegatingSmartContextLoader', parent =
[null]]]
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.634 sec
這裏是整個日誌DAOTest
類:
-------------------------------------------------------------------------------
Test set: sample.library.dao.DAOTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.634 sec
什麼東西被什麼錯呢?如有必要,我可以提供更多信息。