-
[스프링] 500 에러 : TooManyResultsException개발 여정/Error 2021. 9. 7. 17:59
There was an unexpected error (type=Internal Server Error, status=500).
nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2
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
*문제 원인
- 주로 Mapper에 있음.
- 예시1) Mapper의 ResultType을 잘못 명시한 경우 (ex. Class 객체로 받아야 하는데 int로 씀)
- 예시2) ResultType이 int인데 쿼리에서 select 컬럼을 모두 가져온 경우
-> 수정: selelct count(1) from 테이블
- 예시3) ResultType을 List로 받아야 하는데 BO, DAO 변수를 Class객체로 설정한 경우
등등..
'개발 여정 > Error' 카테고리의 다른 글
tomcat not allowed 에러 (0) 2021.09.16 에러 : unable to load server configurations from 어쩌구 / java.io.FileNotFoundException (0) 2021.09.16 에러: Parameter index out of range (0) 2021.09.15 400 에러 Bad Request (0) 2021.09.15 c:when문이 반영이 안됐던 이유 (result의 키값) (0) 2021.09.10