Mybatis 批量Update失败,单条成功

Mybatis 批量更新只有一条记录执行成功,传入多条记录批量更新时,则提示失败:

org.springframework.jdbc.BadSqlGrammarException:
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '......
### The error may involve .... 
### The error occurred while setting parameters ### SQL:

经过排查代码和sql语句均无问题,发现mybatis批量插入与更新时,需在数据库连接(jdbcurl)时指定allowMultiQueries=true

jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&zeroDateTimeBehavior=round&allowMultiQueries=true

你可能感兴趣的:(Mysql,批量更新,update,数据库)