Development/에러 해결

[MyBatis] MyBatis로 조회시 attempted to return null from a method with a primitive return type (int).

늄늄늄 2020. 10. 6. 14:13

 

데이터를 조회하다가 attempted to return null from a method with a primitive return type (int).라는 메시지가 콘솔에 찍혔다. 즉, 내가 반환받는 타입은 int형인데 조회한 데이터가 조건에 맞지않아 조회가 되지않아서 null을 반환하는 것..

 

public int selectUserNm(HashMap param) throws Exception {
    return loginDao.selectUserNm(param);
}

 

위에 사진을 보면 int형으로 반환을 받도록 되어있다.. int형으로는 null을 받아 낼 수없어
아래와 같이 Integer로 수정해서 반영했다.

 

public Integer selectUserNm(HashMap param) throws Exception {  
return loginDao.selectUserNm(param);  
}

 

이렇게 수정하니 정상적으로 작동했다.