当前位置:网站首页>错误Invalid bound statement (not found): com.ruoyi.stock.mapper.StockDetailMapper.xxxx解决
错误Invalid bound statement (not found): com.ruoyi.stock.mapper.StockDetailMapper.xxxx解决
2022-07-03 02:22:00 【梦远星帆】
网络有许多解决方法,我都没有解决,结果发现原来是文件xml.xml了,多了一个.xml
下面附上其他方法:
1.检查xml文件所在package名称是否和Mapper interface所在的包名
<mapper namespace="me.tspace.pm.dao.UserDao">
mapper的namespace写的不对!!!注意系修改。
2.UserDao的方法在UserDao.xml中没有,然后执行UserDao的方法会报此
3. UserDao的方法返回值是List<User>,而select元素没有正确配置ResultMap,或者只配置ResultType!
4. 如果你确认没有以上问题,请任意修改下对应的xml文件,比如删除一个空行,保存.问题解决
5.看下mapper的XML配置路径是否正确
关于Mybatis-plus报错Invalid bound statement (not found):com.xxx.xxx.xxxMapper.selectList
出现这个报错有可能是在写自己的UserMapper时继承了BaseMapper 但没有添加泛型。
只需要添加对应的泛型,
结果就不会报错了
如果全部检查了一遍,还发现没有问题,最好看下自己的配置文件,那时候很有可能是配置少了扫描mapper的东西:
在创建SqlSessionFactory的时候,加了以下配置:
sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/*.xml"));
sqlSessionFactoryBean.setTypeAliasesPackage("com.test.maper");
而且注意sqlSessionFactoryBean.setTypeAliasesPackage参数不支持通配符*,如果有多个包可以通过","等分割
如果需要加载依赖传递过来的jar包中的mapper目录下的xml,classpath:mapper/*.xml 修改为classpath*:mapper/*.xml
边栏推荐
- Codeforces Round #418 (Div. 2) D. An overnight dance in discotheque
- 【 tutoriel】 Chrome ferme les cors et les messages de la politique inter - domaines et apporte des cookies à travers les domaines
- Su Shimin: 25 principles of work and life
- easyExcel
- UDP receive queue and multiple initialization test
- GBase 8c触发器(三)
- iptables 4层转发
- [advanced ROS] Lesson 6 recording and playback in ROS (rosbag)
- Awk from getting started to getting into the ground (3) the built-in functions printf and print of awk realize formatted printing
- easyPOI
猜你喜欢
y54.第三章 Kubernetes从入门到精通 -- ingress(二七)
Recommendation letter of "listing situation" -- courage is the most valuable
[Flutter] dart: class; abstract class; factory; Class, abstract class, factory constructor
stm32F407-------DMA
詳細些介紹如何通過MQTT協議和華為雲物聯網進行通信
创建+注册 子应用_定义路由,全局路由与子路由
awk从入门到入土(0)awk概述
easyExcel
Comment communiquer avec Huawei Cloud IOT via le Protocole mqtt
Create + register sub apps_ Define routes, global routes and sub routes
随机推荐
awk从入门到入土(3)awk内置函数printf和print实现格式化打印
SPI mechanism
My creation anniversary
Machine learning process and method
Summary of ES6 filter() array filtering methods
UDP receive queue and multiple initialization test
Codeforces Round #418 (Div. 2) D. An overnight dance in discotheque
Unrecognized SSL message, plaintext connection?
Leetcode(540)——有序数组中的单一元素
CFdiv2-Fixed Point Guessing-(區間答案二分)
GBase 8c 函数/存储过程参数(一)
MySQL learning 03
Restcloud ETL cross database data aggregation operation
面试项目技术栈总结
Kotlin middle process understanding and Practice (I)
Flink CDC mongoDB 使用及Flink sql解析monggo中复杂嵌套JSON数据实现
Gbase 8C system table PG_ cast
Awk from getting started to being buried (2) understand the built-in variables and the use of variables in awk
Coroutinecontext in kotlin
Packing and unpacking of JS