Mapped Statements collection does not contain value for xxx
这是我第二次遇到的这个问题了,总结下。
第一次的问题是
mybatis的sqlSessionFactory的mapperLocations,配置的是这个路径下的所有映射文件,但是我没写的没有在该路径下,
所有mybatis没有加载我得映射文件,所有就找不到映射文件对应的id。

这次又是另外一个问题
mbatis加载了你的映射文件,但是呢我的id多了个空格,看了好多遍都没发现多了个空格,可能是背景黑色的缘故,强行解释下
哈哈,半个小时没发现问题所在
先看错误信息
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for ProjectStaffDomain_logicDeleteByProjectId
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for ProjectStaffDomain_logicDeleteByProjectId
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
at com.sun.proxy.$Proxy28.update(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:254)
at com.hzhy.framework.core.dao.MybatisGenericDao.update(MybatisGenericDao.java:199)
意思是:没有sql文件中没有定义id为“xxx",一般有以下几种情况
1.mybatis的映射文件的命令空间与接口的全限定名不一致;
2有可能mybatis的映射文件名字与接口的类名字不一致;
3.还有一种情况就是接口声明的方法在映射文件里面没有。
我的sql
<!-- 逻辑删除通过 project_id--> <update id=" ProjectStaffDomain_logicDeleteByProjectId" parameterType="com.hzhy.manager.project.domain.ProjectStaffDomain">
update project_staff set sts='N',modify_time = now(),modify_user_id = #{modify_user_id} where project_id = #{project_id}
</update>
但我一直没发现我的id前面多了个空格,各种百度,结果都没发现这个问题,呜呜呜~ ~ ~ ~
总结:编程不需要眼力,哈哈
Mapped Statements collection does not contain value for xxx的更多相关文章
- Mapped Statements collection does not contain value for xxx.xxx 错误原因&解决方案
先贴出详细的报错信息 2019-11-05 10:10:00 [executor-1] ERROR [org.quartz.core.JobRunShell:225] - Job DEFAULT.ef ...
- MyBatis——Mapped Statements collection does not contain value for XXX
报错信息: Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql. ...
- Mapped Statements collection does not contain value fo
Mapped Statements collection does not contain value for后面是什么类什么方法之类的: 错误原因有几种: 1.mapper.xml中没有加入name ...
- mybatis报错Mapped Statements collection does not contain value for com.inter.IOper
首页 > 精品文库 > mybatis报错Mapped Statements collection does not contain value for com.inter.IOper m ...
- Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for …
编译通过并且运行web成功后,访问的页面不需要连接数据库,不牵扯到反射调用实体类就不会报错, 报错内容如下: [WARNING] org.springframework.web.util.Nested ...
- 【原创】Mapped Statements collection does not contain value for DaoImpl.method
问题: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Pers ...
- Spring+Mybatis整合报错Mapped Statements collection does not contain value原因之一
报错如下: ### Error updating database. Cause: java.lang.IllegalArgumentException: Mapped Statements coll ...
- Mapped Statements collection does not contain value for ResearcherMapper.方法名
搞了半天, 原来是映射文件没加, 新手常遇到的问题. Mapped Statements collection does not contain value for后面是什么类什么方法之类的: 错误原 ...
- Mapped Statements collection does not contain value for TaskMapper.selectByPrimaryKey
Mapped Statements collection does not contain value for后面是什么类什么方法之类的: 错误原因有几种: 1.mapper.xml中没有加入name ...
随机推荐
- C++泛化单链表
泛型单链表 单链表将每个数据分为节点,每个节点存储数据和指向下一个节点的指针.这样数据就不用在内存中使用连续的存储空间,有更大的灵活性. 这里将单链表分为节点类(Node)和链表类(singleLin ...
- Web登录配置-H3C-S5120-LI系列
1.开启http服务和修改端口号 ip http enable ip http port 80 2.添加用户和密码.用户名:admin.密码:admin@123 [Sysname] local-us ...
- Ubuntu18.04-Java8安装
添加ppa sudo add-apt-repository ppa:webupd8team/java sudo apt-get update 安装oracle-java-installer sudo ...
- 为什么我不建议在C#中用下划线_开头来表示私有字段
我在C#官方文档的使用属性里看到这种代码: public class Date { private int _month = 7; // Backing store public int Month ...
- const与指针、引用
const与指针类型 定义一个指针*p: const int* p = NULL; int const* p = NULL; int* const p = NULL; 上面两行定义完全等价,第三行则不 ...
- Python基础之基础知识
目录 Python基础知识 Python 变量 Python 字符编码 Python 二进制 Python 十六进制 Python bytes Python 注释 Python 用户输入 Python ...
- 03.JS运算符
前言: 学习一门编程语言的基本步骤 (01)了解背景知识 (02)搭建开发环境 (03)语法规范 (04)常量和变量 (05)数据类型 (06)数据类型转换 (07)运算符7.运算符 表达式:由运 ...
- Android在Activity中与Fragment中创建自定义菜单的区别
区别就在这里,Activity中添加菜单要这样: public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R ...
- 消息驱动微服务:Spring Cloud Stream
最近在学习Spring Cloud的知识,现将消息驱动微服务:Spring Cloud Stream 的相关知识笔记整理如下.[采用 oneNote格式排版]
- 自定义配置JNOJ
OJ 全名 online judge 在线判题系统,对于从事编程竞赛的人来说一点都不陌生,今天我们讨论的是怎么样自定义搭建 推荐的开源的OJ有hustOJ,JNOJ 因为hustOJ 是一键安装脚本, ...