当前位置:网站首页>错误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
边栏推荐
- Tongda OA V12 process center
- COM和CN
- [tutorial] chrome turns off cross domain policies CORS and samesite, and brings cookies across domains
- GBase 8c系统表-pg_aggregate
- [shutter] shutter debugging (debugging fallback function | debug method of viewing variables in debugging | console information)
- easyExcel
- [Yu Yue education] reference materials of love psychology of China University of mining and technology
- Kotlin middle process understanding and Practice (II)
- Introduce in detail how to communicate with Huawei cloud IOT through mqtt protocol
- Cfdiv2 Fixed Point Guessing - (2 points for Interval answer)
猜你喜欢
内存池(内核角度理解new开辟空间的过程)
创建+注册 子应用_定义路由,全局路由与子路由
Wechat applet development tool post net:: err_ PROXY_ CONNECTION_ Failed agent problem
Introduce in detail how to communicate with Huawei cloud IOT through mqtt protocol
[advanced ROS] Lesson 6 recording and playback in ROS (rosbag)
Producer consumer model based on thread pool (including blocking queue)
Distributed transaction solution
udp接收队列以及多次初始化的测试
通达OA 首页门户工作台
[shutter] pull the navigation bar sideways (drawer component | pageview component)
随机推荐
Awk from getting started to being buried (2) understand the built-in variables and the use of variables in awk
8 free, HD, copyright free video material download websites are recommended
GBase 8c系统表-pg_amop
Introduce in detail how to communicate with Huawei cloud IOT through mqtt protocol
内存池(内核角度理解new开辟空间的过程)
Deep learning notes (constantly updating...)
Gbase 8C system table PG_ conversion
Detailed introduction to the usage of Nacos configuration center
[shutter] shutter debugging (debugging fallback function | debug method of viewing variables in debugging | console information)
Comment communiquer avec Huawei Cloud IOT via le Protocole mqtt
【教程】chrome關閉跨域策略cors、samesite,跨域帶上cookie
Su Shimin: 25 principles of work and life
GBase 8c触发器(三)
GBase 8c系统表-pg_am
[codeforces] cf1338a - Powered addition [binary]
力扣(LeetCode)183. 从不订购的客户(2022.07.02)
Gbase 8C system table PG_ authid
MySQL learning 03
Monitoring and management of JVM
Simple understanding of SVG