mybatis批量修改的小技巧
在mybatis中使用进行批量修改的过程中,遇见了修改一条成功但是多条失败的情况,问题如下:
出现这种问题的原因是mybatis默认以 分号为结尾符,每次只执行一条sql语句,需要在数据库连接url后拼接&allowMultiQueries=true&,例如
jdbc:mysql://localhost:3306/mysql?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=Asia/Shanghai&allowMultiQueries=true&