首页 > 其他分享 >com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: can not find lambda cache for this en

com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: can not find lambda cache for this en

时间:2024-08-09 15:20:50浏览次数:5  
标签:core mybatisplus cache entity com find lambda

异常提示:  com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: can not find lambda cache for this entity

 


使用 mockito 框架做单元测试:
mybatisplus 使用 Lambda 表达式做条件查询、条件更新时会遇到 mybatis 拿不到缓存问题:

错误 1:com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: can not find lambda cache for this entity
错误 2:can not find lambda cache for this property [XXX] of entity [com.XXX.XXX]

解决方法:
在 LambdaQueryWrapper<TaskPO> 或 LambdaUpdateWrapper<TaskPO> 条件之前添加以下语句

TableInfoHelper.initTableInfo(new MapperBuilderAssistant(new MybatisConfiguration(), ""), 条件类名.class);

比如 TableInfoHelper.initTableInfo(new MapperBuilderAssistant(new MybatisConfiguration(), ""), TaskPO.class);

 

补充

IntelliJ IDEA 添加单元测试插件 TestMe

 

标签:core,mybatisplus,cache,entity,com,find,lambda
From: https://www.cnblogs.com/hapday/p/18350778

相关文章

  • asp.net core 6 发布docker
    一、在项目当中创建dockerfile文件设置dockerfile属性为“始终复制”,FROMmcr.microsoft.com/dotnet/aspnet:6.0ASbaseWORKDIR/webCOPY..EXPOSE80EXPOSE443FROMbaseASfinalENTRYPOINT["dotnet","OneZhanMVC.dll"]二、创建镜像cd项目目录......
  • MybatisPlus的分页插件简单使用
    MyBatis-Plus提供了强大的分页插件,可以方便地实现数据库查询结果的分页。以下是关于MyBatis-Plus分页插件的详细介绍,包括如何配置和使用。1.添加依赖首先,需要在项目中添加MyBatis-Plus和分页插件的相关依赖。使用Maven,在pom.xml文件中添加:<dependency><groupId>......
  • 使用SixLabors.ImageSharp 进行图片的缩放C#.net core,可跨平台运行
    引用命令空间usingSixLabors.ImageSharp;using SixLabors.ImageSharp.Formats.Png;using SixLabors.ImageSharp.Processing; publicstaticvidResize(byte[]imageBytes,intwidth=400){usingvarsteam=newMemoryStream(imageBytes);using(varimage=......
  • OS-Ubuntu-从源查询拉取安装包依赖-apt-cache&apt download
    OS-Ubuntu-从源查询拉取安装包依赖-apt-cache&aptdownload引用:Ubuntuapt-getapt-cache命令使用apt-get下载包及所有依赖指令apt-cachedepends--no-*--no-pre-depends--no-suggests--no-recommends--no-conflicts--no-breaks--no-enhances--recurseap......
  • PageOffice6国产Linux系统最简集成代码(.NetCore)
    本文描述了PageOffice产品在.NetCore项目中如何集成调用。PageOffice国产版:支持信创系统,支持银河麒麟V10和统信UOS,支持X86(intel、兆芯、海光等)、ARM(飞腾、鲲鹏、麒麟等)、longarch芯片架构。新建.NetCore项目:PageOffice6-Net-Core-Simple在此项目的“依赖项-包-管理NuGet程序......
  • IgniteFAQ-2-CacheWriterException: Failed to write entries in database
    ignite同步或者异步落库数据到DB时,如果因为落库的数据不满足db库的要求,如长度、精度、nonull等限制,就会出现落库失败报Failedtowriteentriesindatabase错误。ignite异步落库默认时5秒或者10240条flush一次,失败的数据会不断尝试,当存在一条数据以为数据库要求失败时,会卡住此表......
  • [rCore学习笔记 023]任务切换
    导读还是要先看官方手册.学过DMA的同志可能比较好理解,一句话,释放CPU总线:如果把应用程序执行的整个过程进行进一步分析,可以看到,当程序访问I/O外设或睡眠时,其实是不需要占用处理器的,于是我们可以把应用程序在不同时间段的执行过程分为两类,占用处理器执行有效任务的计算阶......
  • ASP.NET CORE微信支付回调示例代码
    ASP.NETCORE微信支付回调示例代码 ///<summary>///接收微信支付异步通知///</summary>///<returns></returns>publicasyncTask<ActionResult>NotifyUrl(){//读取请求体中的数据/*......
  • Python使用Memcached示例
    关注我,持续分享逻辑思维&管理思维&面试题;可提供大厂面试辅导、及定制化求职/在职/管理/架构辅导;推荐专栏《10天学会使用asp.net编程AI大模型》,目前已完成所有内容。一顿烧烤不到的费用,让人能紧跟时代的浪潮。从普通网站,到公众号、小程序,再到AI大模型网站。干货满满。学成后可......
  • asp .net core 启动过程
    1.要了解启动过程,先介绍 IHostingStartup和IStartup接口///<summary>///Representsplatformspecificconfigurationthatwillbeappliedtoa<seecref="IWebHostBuilder"/>whenbuildingan<seecref="IWebHost"/>.///</summary......