스프링 오류

예외 메시지 내용

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}로 사용


스프링 오류

 예외 메시지 내용

Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException


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

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException

### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ~~


원인1

 - 잘못된 SQL 문법을 사용

해결1

 - 올바른 SQL문으로 수정


원인2

 - Mapper에서 외부 정보를 ${변수명}으로 표현한 경우

해결2

 - 외부 정보를 #{변수명}으로 수정



+ Recent posts