Mapper method ... attempted to return null from a method with a primitive return type (int).

Yeoonnii·2022년 11월 8일
0

MyBatis

목록 보기
6/10

오류

데이터를 삭제할 때 오류가 발생했다

오류메세지의 내용은 내가 반환받는 타입은 int형인데 실행되는 쿼리문의 결과가 조건에 맞지 않아 조회가 되지 않아서 null을 반환한다는 것이다

해결

int 형으로는 null을 받아낼 수 없기 때문에
반환타입을 Integer로 변환해 주었더니 오류가 없이 실행된다

BoardMapper.java

// 게시글 하위 좋아요 삭제
public Integer deleteOneLikes(Long bno);

0개의 댓글