본문 바로가기
Error

[에러] mybatis - java.lang.illegalargumentexception: mapped statements collection does not contain value for

by HTT 2023. 1. 5.

1. mapper.xml에 정의한 id가 다른 경우

java(Service or DAO) 파일과 mapper.xml 파일 비교하기

<insert id="insert">
sqlSession.insert(com.project.service.insert, board);

 

2. Parameter와 bean의 필드명이 틀린 경우

 

3. namespace가 다른 경우

java(Service or DAO)파일과 mapper.xml 파일 비교하기

<mapper namespace="com.project.service">
sqlSession.insert(com.project.service.insert, board);

 

4. mybats설정파일에 정의한 namespace확인하기

정의되어 있는지, 스펠링이 틀리지 않았는지 확인하기

<configuration>
    <typeAliases>
        <typeAlias type="com.project.manager.ManagerDTO" alias="manager"/>
    </typeAliases>
    <mappers>
    <mapper resource="mapper/manager.xml"/>
    </mappers>
</configuration>

 

5. mapper에 정의된 namespace명칭이 같은 Application 내에 중복된 경우

 

 

 

 

 

참고 및 출처

https://blog.naver.com/javaking75/220315971085

댓글