[spring] Mapper method 'com.kjh.sanction.mapper.SanctionMapper...

[spring] Mapper method 'com.kjh.sanction.mapper.SanctionMapper...

컨트롤러에서 데이터를 조회하는 쿼리를 실행하니 아래와 같은 에러가 발생했다.

org.apache.ibatis.binding.BindingException: Mapper method 'com.kjh.sanction.mapper.SanctionMapper.tmprAt attempted to return null from a method with a primitive return type (int).

내가 반환받을 타입은 int인데 조회한 데이터는 int가 아니기 때문에 조회를 하지 못하고 null을 반환한 것이다.

내가 작성한 쿼리문이다.

SELECT 1 FROM ELCTRNSANCTN WHERE TMPR_AT = 'Y' AND ELCTRN_SANCTN_SN = #{elctrnSanctnSn}

위 코드를 보면 resultType이 int인데, int 타입으로는 null을 받을 수 없기 때문에 오류가 발생한 것이다.

따라서 resultType을 수정해주었다.

from http://h-developer.tistory.com/41 by ccl(A) rewrite - 2021-12-22 10:27:06