在没有异常的情况下,为什么事务被回滚了呢?该对象未被保存。 我已经定义了事务参数如下:
@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 [TestContext@51e2a069
testClass = DAOTest, testInstance = sample.library.dao.DAOTest@7591777e, testMethod =
testSaveDao@DAOTest, testException = [null], mergedContextConfiguration =
[MergedContextConfiguration@213c2d7f 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
错误出在哪里?如果需要,我可以提供更多信息。