org.apache.ibatis.exceptions.PersistenceException:
Error updating database. Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='lectureInstructor', 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 #2 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 부적합한 열 유형: 1111
The error may involve defaultParameterMap
The error occurred while setting parameters
이 에러는 MyBatis가 데이터베이스 열에 대한 매핑 문제로 인해 SQL 문을 실행하지 못할 때 발생한다.
이 에러의 메시지를 살펴보면, 'Could not set parameters for mapping'라는 메시지와 'Error setting null for parameter #2 with JdbcType OTHER'라는 메시지가 있다.
이것은 MyBatis가 인자 매핑에 문제가 있다는 것을 나타낸다.
MyBatis가 매핑한 두 번째 매개 변수에 null 값을 할당할 수 없으며, 이를 JDBC 유형 OTHER와 함께 사용할 수 없기 때문에 오류가 발생했다.
대부분 인터넷에서는 오타나 데이터 타입이 다를 경우에 생긴다고 한다.
<tr>
<td>강사명</td>
<td>
<input type="text" name="instructorName">
</td>
</tr>
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
String lectureName = request.getParameter("lectureName");
String lectureInstructor = request.getParameter("lectureInstructor");
String lectureIntroduce = request.getParameter("lectureIntroduce");
나의 경우는 jsp에서 가져올 강사명 변수이름인 instructorName과 doPost에서 request로 받는 lectureInstructor이 달라 부적합한 열 유형 판정이 나왔다.
둘중하나를 수정해 변수명을 맞춰줌으로써 해결할 수 있었다.
출처: https://koeiking11.tistory.com/entry/부적합한-열-유형-1111 [코더에서 개발자로 가는길.:티스토리]