nested exception is org.apache.ibatis.binding.BindingException: Parameter not found 해결책 2가지

개발하다보면 nested exception is org.apache.ibatis.binding.BindingException 에러를 만나게 되는데,
Mybatis의 SQL 문장에 여러개의 파라미터를 전달할 때 SQL Mapper 에서 파라미터를 제대로 매핑하지 못해서 발생하는 에러이다.


해결책1

소스에서 파라미터앞에 @Param 어노테이션을 추가한다.

예제)
List selectUserList(@Param(“userName”) String userName, @Param(“region”) String region)


해결책2

로컬 이클립스에서 기동시 @Param 안붙여도 에러가 안나도록 하려면 다음과 같이 하면 된다.


프로젝트 우클릭 Properties > Java Compiler >

Clssfile Generation 항목에 있는
store information about method parameters 를 체크 후 저장한다.

그럼 Rebuilding 과정이 진행이 되고 이클립스 하단에 있는 Rebuilding 프로그레스바가 100%로 끝나고
다시 기동해보면 에러가 나지 않는다.