Expected one result (or null) to be returned by selectOne(), but found 2
这个问题在于你查询sql返回结果是多个值、一个集合,但是你在service的实现层的dao都调用了.get方法。而是应该使用.getlist方法等。
Expected one result (or null) to be returned by selectOne(), but found 2的更多相关文章
- Caused by: org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2
异常信息 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with na ...
- Expected one result (or null) to be returned by selectOne(), but found: 3
Expected one result (or null) to be returned by selectOne(), but found: 3 返回应该是对象但是给的是list
- Expected one result (or null) to be returned by selectOne(), but found: 2 和 java.lang.UnsupportedOperationException异常
在学习MyBatis的时候,简简单单的MyBatis+MySql的增删改查操作,但是却出了问题. 刚开始数据库只有一条数据的时候,岁月静好,一切看起来都那么的OJBK.但是,当我往数据库插入第二条数据 ...
- 测试环境部署之填坑记录-Expected one result (or null) to be returned by selectOne(), but found: 2
最近在部署性能测试环境的时候,环境 部署好以后,部分功能出现接口查询异常,问题现象: 拿到错误,肯定要先判断是前端还是后端代码的问题,最简单的方式是抓包查看: 以上是报错页面捕获的接口报错,很明显的接 ...
- Expected one result (or null) to be returned by selectOne() 数据库结果集和java实例
mybatis会根据查询的结果集初始化java实例. 如果是复杂类型,我们一般都会在mapper中做好映射. 1.所以如果查询到的是多个结果,那么对应的java类型也必须的集合类型.(result 为 ...
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 3报错解决
报错的原因翻译出来: 预期的一个结果(或null)返回selectOne(),但发现:3 意思就是你想得到一个结果值,但是返回了三个结果值. 一般可能测试的时候我们存了几条一样的数据,在登录时,会把同 ...
- 【java异常】Expected one result (or null) to be returned by selectOne(), but found: 63
OmQuotaTBBean omQuotaTBBean = mOmQuotaTBMapper.findOmQuotaTB(); 改成 List<OmQuotaTBBean> listOmQ ...
- 一个坑:java.sql.ResultSet.getInt==》the column value; if the value is SQL NULL, the value returned is 0
Retrieves the value of the designated column in the current row of this ResultSet object as a String ...
- MyBatis入门基础(一)
一:对原生态JDBC问题的总结 新项目要使用mybatis作为持久层框架,由于本人之前一直使用的Hibernate,对mybatis的用法实在欠缺,最近几天计划把mybatis学习一哈,特将学习笔记记 ...
随机推荐
- java @Autowired与@Resource的区别
@Autowired与@Resource的区别 1.@Autowired与@Resource都可以用来装配bean. 都可以写在字段上,或写在setter方法上. 2.@Autowired默认 ...
- C++与零值比较
1.布尔值与零值的比较 if(flag)//if为真 if(!flag)//if为假 其它都为不良风格: if (flag == TRUE) ) if (flag == FALSE) ) 2.整形值与 ...
- VBA_Excel_教程:Option,错误处理
Option Explicit '强制对模块内所有变量进行声明 Option Compare Text '字符串不区分大小写 '指定数组的第一个下标为1(只能指定0或1) Sub s1() On Er ...
- Notepad++的xml文本格式化
1.需要使用插件 2.使用插件
- hibernate复合主键
需要用到实体类Role的主键和Menu的主键结合起来作为实体类RoleMenu的主键,那么通过Hibernate具体实现如下: RoleMenu实体类:(注意该实体类需要实现Serializable接 ...
- 【SSM 8】spring集成Mybatis通用Mapper
上篇博客中介绍了关于Mybatis底层封装的思路问题,那么这篇博客,就介绍一下怎么引入通用的mapper插件. 备注:本项目通过maven管理 关键版本说明: spring:4.1.3.RELEASE ...
- sql: 去除数据库表中tab、空格、回车符等特殊字符的解决方法
去除tab.空格.回车符等使用replace语句 按照ASCII码, SELECT char(64) 例如64 对应 @,则select REPLACE('abc@qq.com',char(64),' ...
- Opencv配置问题_Error LNK2019
终于配好opencv(Win7 64位+VS2013+opencv2.4.9),兴奋的写了第一个程序(当然是显示lena的玉照了): #include <opencv2\opencv.hpp&g ...
- Google黑板报: 数学之美系列(网上找的原链接)
转载地址:http://blog.sina.com.cn/s/blog_47cccb02010009u0.html 系列一 -- 统计语言模型 http://googlechinablog.com/2 ...
- TeXmacs 中输入狄拉克 braket 符号
TeXmacs的数学模式下,默认会对括号进行自动补齐.这也导致输入狄拉克 braket 符号时得到的可能不是你想要的结果.经测试,可用以下输入方式输入 (以下 _ 表示光标所在位置,Tab代表Tab键 ...