1、为什么会报语法错误

  原因:在 *.xml文件内使用了循环,在mybatis中默认是不允许使用批量修改。

<update >
    <foreach collection="list" item="item" index="index" open="" close="" separator=";">
        update fm_info
        <set>
            max_degree= #{item.maxDegree,jdbcType=decimal},
min_degree= #{item.minDegree,jdbcType=decimal},
degree= #{item.degree,jdbcType=decimal} </set> <where> id = #{item.id,jdbcType=INTEGER} </where> </foreach> </update>

2、解决方法

  在连接mysql的url后面加上 《   allowMultiQueries=true   》

jdbc.url=jdbc:mysql://localhost:3306/flow_meter?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true

 

相关文章:

  • 2021-10-02
  • 2022-01-09
  • 2021-12-12
  • 2021-10-19
  • 2021-11-20
  • 2022-01-05
  • 2021-08-29
  • 2021-10-19
猜你喜欢
  • 2021-08-07
  • 2021-11-19
  • 2021-09-16
  • 2021-09-05
  • 2022-01-01
  • 2019-10-10
  • 2018-09-10
相关资源
相似解决方案