24.02.02

서린·2024년 2월 2일

혼자개발

목록 보기
35/82

이번엔 북마크에 났었던 에러를 풀어보려고 한다
예전에 났었는데 다른 기능들을 하던중이라 잠시 미뤄뒀었다

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: 50
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 50

console

2024-02-02 14:51:15,695 DEBUG [com.project.mountain.mapper.MountainMapper.selectMountain] <==      Total: 50
2024-02-02 14:51:15,701 ERROR [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 50] with root cause
org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 50

리턴을 두개이상 받는데 하나만 가져오는 코드로 되어있다는 뜻인것같았다

bookmark 페이지에 뿌려지는 mountain이 하나로만 되어있어서
List로 수정했다
BookmarkController.java

List<Mountain> mountain = mountainBO.getMountainBookmark();

mountain을 List로 수정해주니까 에러가 사라지고 즐겨찾기 페이지가 다시 보여졌다

0개의 댓글