大家好,我是田哥
本文是MyBatis源码分析系列文章的第11篇,本文主要内容:
常见的异常分析
下面是我给大家总结的MyBatis常见异常级原因说明。
具体内容如下:
参数名不对Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
错误:匹配不了
原因:配置文件中的id方法名和dao接口中的方法名不一致
出现多条数据executor.ExecutorException: Statement returned more than one row, where no more than one was expected
错误:返回了多行
原因: 或许你想要的是一个对象,但是返回值是一个list.
解决方案:修改返回值类型
版本问题java.lang.IllegalStateException: SpringJUnit4ClassRunner requires JUnit 4.12 or higher
原因:版本的型号的问题,只兼容 junit 4.12 版本,切换版本即可。
实体类不存在Could not resolve type alias ‘users’. Cause: java.lang.ClassNotFoundException: Cannot find class: users
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)