spring@transactional如何管理事务

rmbxnbpk  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(205)

Spring怎么样 @Transactional 管理交易。假设下面是一个方法示例,如果数据库崩溃,那么我观察到 @Transactional 抛出以下错误。。它不会执行 writeStuff() .. 这种行为正确吗 @Transactional 什么?

Caused by: org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is com.ibm.websphere.ce.cm.StaleConnectionException: [Teradata JDBC Driver] [TeraJDBC 15.10.00.05] [Error 1000] [SQLState 08S01] Login failure for Connection to
@Transactional(value = "txnMngr", propagation = Propagation.REQUIRED, isolation = Isolation.READ_UNCOMMITTED)
    public void writeStuff() {

      // write something to your database
    }

这是我的bean配置

<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource"/>
        <qualifier value="txnMngr"/>
    </bean>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题