mybatis批量更新(update foreach)是多个语句运行失败

最近做项目时遇到一个很奇葩的现象,项目是 Spring + SpringMVC + Mybatis 


  
    update kpxt_xtsz_spbm
    set sl = #{item.slpledit,jdbcType=VARCHAR}
    where del_flag='0' and id= #{item.id,jdbcType=VARCHAR};
  

int batchUpdate(List list);

 

public int updateAllspbm(String slpledit,String data){
    int result = 0;
    String[] dataS = data.split(",");
    List list = new ArrayList();
    if(dataS.length>0){
        for (int i=0;i 
  

运行时报错如下:

check the manual that corresponds to your MySQL server version for the right syntax to use near‘update kpxt_xtsz_spbm set sl =? where id=?’

 

找了很久发现jdbc.properties的url中少了配置

加上 &allowMultiQueries=true 就可以批量执行语句了

 

你可能感兴趣的:(mybatis)