mybatis批量操作出现的错误 the error occurred while setting parameters
前提:批量操作可以直接使用循环,然后循环内调用 mybatis-plus提供的insert、update 等方法,但是考虑到执行效率的问题及减小数据库连接次数(一定的数据量操作),故使用SQL拼接语句进行批量insert or update or delete
所遇到问题: the error occurred while setting parameters
问题解决方式:是由于mysql的配置导致的,一般来说 “allowMultiQueries” 这个属性默认值为false ,只需要将该属性设置为true 即可,如下:
url:jdbc:mysql://localhost:3306/mei?characterEncoding=utf8&allowMultiQueries=true