解决org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)问题

简介: 解决org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)问题

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)问题,即在mybatis中dao接口与mapper配置文件在做映射绑定的时候出现问题,简单说,就是接口与xml要么是找不到,要么是找到了却匹配不到。


需要检查的步骤:


1.是否mapper.java文件上使用了注解@Mapper  或者 在启动类上扫描了Mapper类 @MapperScan("com.heima.model.mappers")   【注意扫描的包名是否正确】


2.注意mapper.xml文件中的namespace是否正确指向到Mapper.java类的位置 【<mapper namespace="com.heima.model.mappers.app.ApUserArticleListMapper">】


3.注意被调用的方法名在mapper.java中和mapper.xml中的id保持一致性


4.注意mapper.xml方法的parameterType尽量指定全路径的domain


5.注意Mapper.java在被调用的地方需要注入@Autowired


6.最终,一定一定要注意你建立的mapper.xml是xml文件,因为你创建的file在idea上默认会被识别为xml文件的图标,即使你没有指明后缀!!!


参照下图检查


1.检查java配置文件类上是否使用了注解@Mapper  或者在启动类上扫描了Mapper类,注意扫描的包名是否正确  


19.png


2.注意mapper.xml文件中的namespace是否正确指向到Mapper.java类的位置


20.png


3.注意被调用的方法名在mapper.java中和mapper.xml中的id保持一致性


21.png22.png


4.注意mapper.xml方法的parameterType尽量指定全路径的domain

5.注意Mapper.java在被调用的地方需要注入@Autowired


23.png


6.最终,一定一定要注意你建立的mapper.xml是xml文件,因为你创建的file在idea上默认会被识别为xml文件的图标,即使你没有指明后缀!!!


24.png


然后我自己报出这个错,找了一下午,各种对名字,百度的方法都不管用,最终发现了问题所在原因是-----> resources 底下xml和mapper接口的路径不同,


这里我创建的包名是cmappers.app,它在这里不是一级一级的创建文件夹而是创建了一个mappers.app名字的一个包 ,


25.png


所以需要cmappers/app 这样创建

目录
打赏
0
2
2
0
12
分享
相关文章
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):XXXXX
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):XXXXX
120 1
Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid
Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.example.forum.d
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.example.forum.d
86 1
【已解决】nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘qcBizname‘ not found
【已解决】nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘qcBizname‘ not found
437 0
Apache Flink 实践问题之原生TM UI日志问题如何解决
Apache Flink 实践问题之原生TM UI日志问题如何解决
63 1
The Past, Present and Future of Apache Flink
本文整理自阿里云开源大数据负责人王峰(莫问)在 Flink Forward Asia 2024 上海站主论坛开场的分享,今年正值 Flink 开源项目诞生的第 10 周年,借此时机,王峰回顾了 Flink 在过去 10 年的发展历程以及 Flink社区当前最新的技术成果,最后展望下一个十年 Flink 路向何方。
409 33
The Past, Present and Future of Apache Flink
|
4月前
|
Apache Flink 2.0-preview released
Apache Flink 社区正积极筹备 Flink 2.0 的发布,这是自 Flink 1.0 发布以来的首个重大更新。Flink 2.0 将引入多项激动人心的功能和改进,包括存算分离状态管理、物化表、批作业自适应执行等,同时也包含了一些不兼容的变更。目前提供的预览版旨在让用户提前尝试新功能并收集反馈,但不建议在生产环境中使用。
1048 13
Apache Flink 2.0-preview released
分布式锁服务深度解析:以Apache Flink的Checkpointing机制为例
【10月更文挑战第7天】在分布式系统中,多个进程或节点可能需要同时访问和操作共享资源。为了确保数据的一致性和系统的稳定性,我们需要一种机制来协调这些进程或节点的访问,避免并发冲突和竞态条件。分布式锁服务正是为此而生的一种解决方案。它通过在网络环境中实现锁机制,确保同一时间只有一个进程或节点能够访问和操作共享资源。
182 3
Apache Doris Flink Connector 24.0.0 版本正式发布
该版本新增了对 Flink 1.20 的支持,并支持通过 Arrow Flight SQL 高速读取 Doris 中数据。
基于RabbitMQ与Apache Flink构建实时分析系统
【8月更文第28天】本文将介绍如何利用RabbitMQ作为数据源,结合Apache Flink进行实时数据分析。我们将构建一个简单的实时分析系统,该系统能够接收来自不同来源的数据,对数据进行实时处理,并将结果输出到另一个队列或存储系统中。
403 2

热门文章

最新文章

推荐镜像

更多
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等