스프링/에러 노트

스프링 오류 - Parameter 'A' not found. Available parameters are [B]

내숭 2020. 7. 29. 10:36

스프링 오류

예외 메시지 내용

Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'A' not found. Available parameters are [B]


예외 메시지 상세 내용 중 일부

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'A' not found. Available parameters are [B]


원인

 - Dao에서 넘겨준 매개변수 객체 B에 멤버 변수 A가 없는 경우


해결

 - 객체 B의 멤버 변수 A가 있는지 확인하여 없으면 추가

 - 있는 경우에 에러가 나는 경우

  1. Dao에 @Param("B")을 넣어줬으면 Mapper에서 #{B.A}로 사용

  2. Dao에 @Param("B")를 안 넣어줬으면 Mapper에서 #{A}로 사용