Java Spring with Microsoft SQL Server 2005 - 9.00.4035.00(X64)2008年11月24日16:17:31版权所有(c)1988-2005 Microsoft Corporation标准版(64位)在Windows NT 5.2上(Build 3790:Service)包2)
我使用的事务管理器如下,通常效果很好
<tx:advice id="TxAdvice" transaction-manager="TransactionManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" rollback-for="java.lang.Throwable"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:advisor pointcut="execution(* com.rdc.*.*Dao.*(..))" advice-ref="TxAdvice"/>
</aop:config>
但是我发现在第2行数据库锁定时执行以下方法时出现异常情况并且sqlserver 2008生成数据库锁定超时并且语句1记录变为永久而不是回滚数据?并生成异常
public void linkDao(){
insert(); // 1
update(); // 2
delete(); // 3
}
StackTrace: org.springframework.transaction.TransactionSystemException: Could not roll back JDBC transaction; nested exception is java.sql.SQLException: Invalid state, the Connection object is closed.
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doRollback(DataSourceTransactionManager.java:279)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:823)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:800)
at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:339)
答案 0 :(得分:0)
我试过这个命令来释放一些momeory
DBCC FREESYSTEMCACHE (‘ALL’) WITH MARK_IN_USE_FOR_REMOVAL;