에러 Could not set parameters for mapping: ParameterMapping : 부적합한 열 유형 : 1111
Could not set parameters for mapping: ParameterMapping : 부적합한 열 유형 : 1111
- 전체 오류 메세지
-
Request processing failed; nested exception is org.mybatis.spring.
MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property=’pro_cd’, mode=IN, javaType=class java.lang.Object, jdbcType=null, numericScale=null, resultMapId=’null’, jdbcTypeName=’null’, expression=’null’}. Cause: org.apache.ibatis.type.TypeException: Error setting null for parameter #1 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 부적합한 열 유형: 1111]을(를) 발생시켰습니다.
-
mybatis 오류 , 즉 mapper.xml 에 매개변수로 들어와야할 ‘pro_cd’가 들어오지 않아 발생하는 문제
(parameter로 들어와야 할 값이 안들어와서 오류가 발생)
- -> 그렇다면 어느 시점부터 들어오지 않는걸까?
-
디버깅 해보기로 함
1) 컨트롤러 (핸들러함수)
컨트롤러의 핸들러 함수까진 무사히 들어옴
- 서비스
일단 문제 1 . 여기서 this는 projectController.view() 를 나타내기 때문에 밖에 선언되어있는 viewProjectService를 호출 할 수 없음
-> this.viewProjectService를 viewProjectService로 수정
f5 버튼으로 함수 안으로 들어옴
-> 이때까지 pro_cd값 잘 전달되는거 확인
- 매퍼
여기서 f5누르니까 내가 따로 만들어준적 없는 invoke 란 함수로 들어감
-> 즉 projectMapper 인터페이스 안까진 정상적으로 들어갔으니 남은건 Mapper.xml 문제
-> 디버깅은 자바코드까지만 할 수 있으므로 이후의 xml 파일은 로그의 에러메세지 보면서 수정해야함
-> 디버깅의 의의 : 문제가 mapper.xml 파일인걸 알 수 있었음
원인 발견
mapper.xml 파일에 pro_cd가 매개변수로 들어와야하는데
그 함수 안으로 pro_cd를 설정해주지 않아서 (+넘겨주지 않아서) 발생하는 문제 !
수정
댓글남기기