当前使用版本(必填,否则不予处理)
3.4.3
该问题是如何引起的?(确定最新版也有问题再提!!!)
使用框架自带API saveBatch saveOrUpdateBatch 无法正常批量更新 执行单个save API 可以正常执行
重现步骤(如果有就写完整)
win10 jdk8 idea2020 mybatisplus-version-3.4.3 无特殊操作,调用批量更新API就会异常
报错信息
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
Error updating database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for ####Mapper.insert
Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for #####Mapper.insert
我debug 发现 调用的中这个地方configuration中的MappedStatement的size为空 ,执行单个保存save API这个MappedStatement是有值的,我跟踪的过程中发现这个configuration 初始化过两次执行批量更新的时候第一次MappedStatement是有值的 第二次确是空的 @Override public int update(String statement, Object parameter) { try { dirty = true; MappedStatement ms = configuration.getMappedStatement(statement); return executor.update(ms, wrapCollection(parameter)); } catch (Exception e) { throw ExceptionFactory.wrapException("Error updating database. Cause: " + e, e); } finally { ErrorContext.instance().reset(); }
Comment From: jidianzhixia
重复引入包导致的
Comment From: zthreea
重复引入包导致的
我也出现了这问题,请问能说仔细点吗,怎么解决