오류 메시지
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='notice_title', mode=IN, javaType=class java.lang.String, 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
상황
update문을 실행시키니 오류가 발생했다.
오류메시지에 jdbcType이 null로 되어있다고 나와 있다.
<update id="updateNotice" parameterType="Notice">
UPDATE notice
SET notice_title=#{notice_title}, notice_content=#{notice_content}
WHERE notice_idx=#{notice_idx}
</update>
해결 방법
#{notice_title}
→ #{notice_title, jdbcType=VARCHAR}
#{notice_content}
→ #{notice_content, jdbcType=VARCHAR}
로 수정하여 jdbcType을 설정하니 해결되었다.
<update id="updateNotice" parameterType="Notice">
UPDATE notice
SET notice_title=#{notice_title,jdbcType=VARCHAR}, notice_content=#{notice_content,jdbcType=VARCHAR}
WHERE notice_idx=#{notice_idx}
</update>
'오류 해결' 카테고리의 다른 글
[DataTables] 3. DataTables warning: Cannot reinitialise DataTable 해결방법 (0) | 2022.09.16 |
---|---|
[DataTables] 4. DataTables warning: Requested unknown parameter 해결 방법 (0) | 2022.09.15 |
[JavaScript] Uncaught TypeError : is not a function 해결 방법 (0) | 2022.09.14 |
[Mybatis] BindingException (0) | 2022.05.09 |
[JDBC] BadSqlGrammarException (0) | 2022.05.03 |
댓글