问题描述:
saveOrUpdateBatch使用这个方法的时候,会有下面这个报错:属实头疼
在出现这种报错后我在网上找了许多解决方法,例如这位大佬写的
error: can not execute. because can not find cache of TableInfo for entity!-CSDN博客
还有这位大佬写的在测试类中,添加mybatis的初始化构建SpringBoot——单元测试error: can not execute. because can not find cache of TableInfo for entity!-CSDN博客
都一一失效,后来在另一位大佬写的文章中受到启发,才得以解决
依赖包替换
将pom文件中原来mybatis依赖替换为baomidou的mybatis-plus依赖后:
添加mybatis_plus 依赖 然后更改版本 (原来我的版本是3.5.1,还是相同错误,后面将版本更改为3.5.5后就成功了)
<!-- mybatis_plus-->
<!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.5</version>
</dependency>
注意:更改完版本后记得重启maven,不会重启的,直接重启IDE吧。