手动设置事务提交
事务 设置 提交 手动
2023-09-27 14:21:38 时间
@Override @Transactional(readOnly = false, rollbackFor = Throwable.class) public void updateIsSyncFromSynchroodata(Paynote paynote) { int count = 0; try { //设置手动提交 this.defaultDao.getJdbcTemplate().getDataSource().getConnection().setAutoCommit(false); String update_sql="update t_paynote set is_sync='"+paynote.getIsSync()+"',proctime='"+paynote.getProctime()+"' where pn_no='"+paynote.getPnNo()+"' and unit_no='"+paynote.getUnitNo()+"' and orderno='"+paynote.getOrderno()+"'"; count= this.defaultDao.getJdbcTemplate().update( update_sql); this.defaultDao.getJdbcTemplate().getDataSource().getConnection().commit(); }catch (Exception e) { e.printStackTrace(); try { this.defaultDao.getJdbcTemplate().getDataSource().getConnection().rollback(); } catch (SQLException e1) { e1.printStackTrace(); } }finally { try { this.defaultDao.getJdbcTemplate().getDataSource().getConnection().setAutoCommit(true); } catch (SQLException e) { e.printStackTrace(); } } }
相关文章
- redis基础之订阅发布、主从复制和事务(四)
- Laravel应用Redis事务
- 软件事务内存导论(九) 集合与事务
- annotation配置springMVC的方法了事务不起作用
- 为什么 MySQL 回滚事务也会导致 ibd 文件增大?
- MySQL在默认事务下各SQL语句使用的锁分析
- Java分布式事务Seata安装和使用,SpringCloud Seata分布式事务安装配置和使用
- SET TRANSACTION - 设置当前事务的特性
- 浅谈tidb事务与MySQL事务之间的区别
- 【SSM直击大厂】第十一章:Spring 事务控制
- 玩转spring boot——结合JPA事务
- mysql测试spring事务是否生效
- 实例详解 EJB 中的六大事务传播属性--转
- 分布式概念简单了解:数据一致性、CAP、BASE、分布式事务、分布式锁
- 分布式事务的四种解决方案