본문 바로가기
오류 해결

[Mybatis] java.sql.SQLException: 부적합한 열 유형: 1111

by 쿠쿠씨 2022. 5. 2.
반응형

 

오류 메시지

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>
반응형

댓글