解决在使用MyBatis-Plus出现异常Invalid bound statement (not found)

在复杂业务场景下,使用MyBatis-Plus时可能遇到Invalid bound statement异常,通常由于XML配置文件位置未声明或者@MapperScan配置不正确导致。通过在application.yaml中设置XML路径或检查MapperScan注解配置可以解决问题。
摘要由CSDN通过智能技术生成

复杂业务场景中都需要自己定制化sql,刚开始使用MyBatis-Plus可能会出现此情况(直接使用自动代码生成器,忽略了配置文件,忘记在配置文件中声明文件位置)

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.jy.serviceedu.mapper.EduSubjectMapper.findAllOne
	at com.baomidou.mybatisplus.core.override.PageMapperMethod$SqlCommand.<init>(PageMapperMethod.java:261)
	at com.baomidou.mybatisplus.core.override.PageMapperMethod.<init>(PageMapperMethod.java:58)
	at com.baomidou.mybatisplus.core.override.PageMapperProxy.cachedMapperMethod(PageMapperProxy.java:70)
	at com.baomidou.mybatisplus.core.override.PageMapperProxy.invoke(PageMapperProxy.java:63)
	at com.sun.proxy.$Proxy94.findAllOne(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflect
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值