본문 바로가기

Trouble Shootings

MyBatis: Result Maps collection already contains value for ~ 에러

MyBatis를 사용하여 API 서버를 개발하던 중, 다음과 같은 에러를 만났다.

 

Result Maps collection already contains value for ~

 

검색을 해보니 중복되는 Id가 존재할 경우 이러한 에러가 발생한다고 해서, 마이바티스의 맵퍼 xml 파일을 뒤져보았다.

 

<resultMap id="MyDto" type="mypackage.MyDto" autoMapping="true">
	...
</resultMap>
...

<resultMap id="MyDto" type="mypackage.MyDto" autoMapping="true">
	...
</resultMap>

 

그 결과, 동일한 Id를 가진 resultMap 구문을 찾았고 이를 수정하니 에러가 발생하지 않았다.

728x90