본문 바로가기
Error

Junit Error : NestedServletException : IncorrectResultSizeDataAccessException

by 뽀또그링 2022. 12. 6.

 

 

에러 메시지

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.IncorrectResultSizeDataAccessException: query did not return a unique result: 2; nested exception is javax.persistence.NonUniqueResultException: query did not return a unique result: 2

조회한 결과 값이 여러 개 일 수 없다!

Repository 쿼리 쪽을 확인해보자.

 

 

 

해결

쿼리에는 문제가 없었다.

왜 결과값이 2개인가 고민해보다 문득 생각난 더미데이터 !

이런, 이렇게 되어 있으니 당연히 조회값이 두 개가 나오지 ...

값을 바꿔준 후 다시 테스트를 진행해보니 정상적으로 잘 되었다 :)