Mybatis批量更新,一条成功,多条失败

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语句拷贝到navicat可以执行成功,经过小伙伴们的帮忙,找到解决办法:只需修改数据库连接配置:&allowMultiQueries=true
例如:

mysql.db.url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&&allowMultiQueries=true

加上这句话,顺利通过批量更新。

你可能感兴趣的:(【javaweb】)