问题描述:
这个是我使用springboot+mybaits进行CRUD操作,从mysql中获取一个数据表显示到前端页面,点击链接后,原本应该会显示所有数据库里的这个表的所有数据信息的,但是显示的是这个错误提示:
Exception in thread "main" org.mybatis.spring.MyBatisSystemException: nested exception is org.apache
.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(),
but found: 2
问题解决:
- 如下图所示,原本此红框的类型我写的是 Users, 而如果是获取一张数据表的所有行的数据,返回的是一个列表对象,而不是单个 Users。