错误原因:数据库查到多条数据,无法返回
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 17
本文探讨了在使用MyBatis框架时遇到的TooManyResultsException异常,详细解析了当数据库查询返回多于一条记录时如何正确处理的问题。通过一个具体案例,分析了错误原因并提供了有效的解决方案。
错误原因:数据库查到多条数据,无法返回
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 17
2577
3万+
11万+
964
4万+

被折叠的 条评论
为什么被折叠?