본문 바로가기
공부방/오류

[오류]Mapped Statements collection does not contain value for​ ~

by SmartCow 2023. 4. 14.

일을 하다가 이런 오류가 생겼는데.. 몸상태가 메롱이라 그런지 왜 발생되는지 찾는게 힘들었던..

 

에러메시지

java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for​ xxxxxxxxxxxxx~

 

오류가 생기는 이유
1. MAPPER ID가 동일하지 않음
   ex) mapper파일에 <select id=''.. 에 id와
         mapper파일에 직접 접근하는 java파일(DAO나 service)에 적어놓은 id값이 동일하지 않음 
2. ParameterBEAN의 필드명이 동일하지 않음
3. MAPPER파일(MyBatis의 쿼리문을 등록한 XML파일) 정의된 네임스페이스(namespace)
    mapper파일에 직접 접근하는 java파일(DAO나 service)에서 호출하는 네임스페이스(namespace)가 동일하지 않음
4. MyBatis config파일에 mapper가 정의가 되어 있지 않거나 Spelling이 동일하지 않음
5. mapper에 정의된 namespace 명칭이 같은 Application 내에 중복 

 

보통 위에 적은 5가지의 상황에서 해당 오류가 발생한다.

 

 

 

하지만 난 그냥 쿼리에 테이블명을 제대로 적지 않아서 발생된 오류였다..

 

참고

 

[에러] 마이바티스 에러 Mapped Statements collection does not contain value for​ ~

에러 : java.lang.IllegalArgumentException: Mapped Statements collection does not contain value ...

blog.naver.com