[springboot/mybatis] Mapper method ~~ has an unsupported return type 오류 처리방법
스프링부트 & 마이바티스 공부하다가
회원쪽 테스트를 진행하다가 발생한 오류는 다음과 같이 나왔다.
Servlet.service() for servlet [dispatcherServlet] in context with path []
threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException:
Mapper method '패키지경로' has an unsupported return type: 패키지경로 with root cause
org.apache.ibatis.binding.BindingException:
Mapper method '패키지경로 has an unsupported return type: 패키지경로
at org.apache.ibatis.binding.MapperMethod.rowCountResult(MapperMethod.java:118)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:67)
at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86)
at jdk.proxy3/jdk.proxy3.$Proxy64.updateMember(Unknown Source)
at com.toy.admin.service.MemberService.updateMember(MemberService.java:46)
at com.toy.admin.controller.MemberContoller.memberUpdateAction(MemberContoller.java:121)
너무 컨디션도 안좋아서 어떤오류인가 한참찾다가
exception is org.apache.ibatis.binding.BindingException: Mapper method '패키지경로' has an unsupported return type: 패키지경로 with root cause
org.apache.ibatis.binding.BindingException: Mapper method '패키지경로 has an unsupported return type: 패키지경로
나의 경우는
찾아보니 mybatis에서 update 처리 후 발생했었던 이슈였다.
update 까지 다 진행하고나서, 계속 오류가 떠서 계속확인해봤는데
결국은 반환값을 int 형으로 바꿔주니 해결되었다.
before : public Member~DTO 함수이름()
after : pulbic int 함수이름()
implememt 쪽이랑 service 쪽 둘 다 수정해주니 이상없이 해결!!!