inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

스프링 DB 2편 - 데이터 접근 활용 기술

MyBatis 적용1 - 기본

주의! MyBatis에서 xml에 insert 사용 시 returnType이 없다.

2035

데스나이트
0

인터페이스 ItemRepository와 ItemMapper가 같은 줄 알고 복붙했다가 참사.. ㅠㅠ

@Mapper
public interface ItemMapper {

    Item save(Item item);

    void update(@Param("id") Long itemId, @Param("updateParam") ItemUpdateDto updateParam);

    Optional<Item> findById(Long id);

    List<Item> findAll(ItemSearchCond cond);
}

MyBatis에서 xml에 insert 사용 시 returnType 속성이 없는데 ItemMapper에서 Item을 리턴하여 에러 발생

Mapper method 'hello.itemservice.repository.mybatis.ItemMapper.save' has an unsupported return type: class hello.itemservice.domain.Item
org.apache.ibatis.binding.BindingException: Mapper method 'hello.itemservice.repository.mybatis.ItemMapper.save' has an unsupported return type: class hello.itemservice.domain.Item

mybatis

답변 1

0

김영한

데스나이트님 공유 감사합니다^^