当前位置:网站首页>Invalid bound statement (not found): com.exam.mapper.UserMapper.findbyid
Invalid bound statement (not found): com.exam.mapper.UserMapper.findbyid
2022-07-28 05:16:00 【jekyhu】
一、问题的出现:
调试代码的时候,把mapper.xml中的方法暂时的注释掉了,之后解除注释后,就出现了这个错误。具体报错如下:

二、解决方法:
1 . mapper.xml中的namespace和实际的mapper文件不一致。

如图中的 namespace,需要和实体类中的mapper一 一对应,否则就会报错。如下图一样,copy reference后放到namespace中就可以解决问题。

2 . mapper接口中的方法名和mapper.xml中的id标签不一致
如下图,select id=“xxxxx” ,xxxxx需要和mapper接口中的方法名一致。

此两处的 findbyid 是需要保持一样的。

3 . target目录下的mapper.xml文件内容与当前的不一致,或者没有构建进target目录。
target目录路径如下图:

(1) target目录下的 mapper.xml 文件内容与当前的不一致
target 文件下的 mapper.xml:

当前的 mapper.xml:

可以看到target中的被我当时注释掉的。把注释去掉就解决问题了。
(2)没有构建进target目录。
在IDEA终端执行下面的代码 :
mvn clean
mvn compile
边栏推荐
- HashSet add
- How practical is the struct module? Learn a knowledge point immediately
- Scope, execution process and life cycle of bean
- HDU 1530 maximum clique
- MySQL date and time function, varchar and date are mutually converted
- C language: addition and deletion of linked list in structure
- php7.1 连接sqlserver2008r2 如何测试成功
- SSLError
- Flink mind map
- MySQL 默认隔离级别是RR,为什么阿里等大厂会改成RC?
猜你喜欢

Eccv2022 | 29 papers of Tencent Youtu were selected, including face security, image segmentation, target detection and other research directions

Keil Chinese garbled code solution

Flask Development & get/post request

Professor dongjunyu made a report on the academic activities of "Tongxin sticks to the study of war and epidemic"

阿里怎么用DDD来拆分微服务?

Configuration experiment of building virtual private network based on MPLS

How does Alibaba use DDD to split microservices?

C language classic 100 question exercise (1~21)

First acquaintance with C language (2)

测试开发---自动化测试中的UI测试
随机推荐
regular expression
Using RAC to realize the sending logic of verification code
The default isolation level of MySQL is RR. Why does Alibaba and other large manufacturers change to RC?
Reading sdwebimage source code Notes
MySQL 默认隔离级别是RR,为什么阿里等大厂会改成RC?
PC端-bug记录
Win10 machine learning environment construction pycharm, anaconda, pytorch
使用nfpm制作rpm包
MySQL practice 45 lectures
Supervisor series: 5. Log
How to successfully test php7.1 connecting to sqlserver2008r2
Clickhouse pit filling note 2: the join condition does not support non equal judgments such as greater than and less than
【CVPR2022】On the Integration of Self-Attention and Convolution
New modularity in ES6
在外包公司两年了,感觉快要废了
【ARIXV2204】Neighborhood attention transformer
Mysql基本查询
JSON in JS (launch object deep copy)
Microservice failure mode and building elastic system
php7.1 连接sqlserver2008r2 如何测试成功