/**PageBeginHtml Block Begin **/ /***自定义返回顶部小火箭***/ /*生成博客目录的JS 开始*/ /*生成博客目录的JS 结束*/

手动设置事务提交

 @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();
            }
        }
    }

 

posted @ 2022-02-10 14:18  一品堂.技术学习笔记  阅读(197)  评论(0编辑  收藏  举报