首页 > 其他分享 >org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned b

org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned b

时间:2022-08-15 21:55:35浏览次数:69  
标签:returned but ibatis Expected result exceptions null selectOne

org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2
mybatis操作数据库时

org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2

原因

因为查询结果的期望值为一条或者为空,但是实际上返回的值有两条。

解决

1、检查数据库数据是否有错误(重复);

2、检查resultType 或resultMap中的数据类型是否和接口中的一致;

3、检查操作数据库的配置文件返回类型是否和java中返回类型一致;

4、检查传递的参数的个数

标签:returned,but,ibatis,Expected,result,exceptions,null,selectOne
From: https://www.cnblogs.com/wyz5/p/wyzErrorsMybatis.html

相关文章

  • ExtJS - UI组件 - Buttion
    更新记录转载请注明出处:https://www.cnblogs.com/cqpanda/p/16587153.html2022年8月15日发布。2022年8月13日从笔记迁移到博客。ExtJS教程汇总:https://www.cnblog......
  • git clone 报错remote:Access denied The requested URL returned error:403
    gitcloneproject_URL命令向远程仓库克隆项目时遇到报错403   error403是服务器拒绝了终端的访问,是账户密码的问题,可是在客户端没有弹出需要输入账户密码的弹窗。......