Bootstrap

MybatisPlusException: error: can not execute. because can not find cache of TableInfo for entity!

问题描述:

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博客

都一一失效,后来在另一位大佬写的文章中受到启发,才得以解决

mybatis-plus框架TABLE_INFO_CACHE获取不到对应的TableInfo对象_error: can not execute. because can not find cache-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吧。

悦读

道可道,非常道;名可名,非常名。 无名,天地之始,有名,万物之母。 故常无欲,以观其妙,常有欲,以观其徼。 此两者,同出而异名,同谓之玄,玄之又玄,众妙之门。

;