MyBatis 插入空值时,需要指定JdbcType

报错内容:
### Cause: org.apache.ibatis.type.TypeException: Error settingnull for parameter #10 with JdbcType OTHER . Try setting adifferent JdbcType for this parameter or a differentjdbcTypeForNull configuration property. Cause:java.sql.SQLException: 无效的列类型

MyBatis 插入空值时,需要指定JdbcType
mybatisinsert空值报空值异常,但是在pl/sql不会提示错误,主要原因是mybatis无法进行转换,

解决方法:

在insert语句中,增加jdbcType解决问题

<insert id="save"parameterType="Province">
<wbr> &lt;![CDATA[</wbr>
<wbr> insert into t_yp_province</wbr>
<wbr>(fid,fname,fnumber,fsimpleName,fdescription,fcreateTime,flastUpdateTime,fdirect)</wbr>
<wbr> values</wbr>
<wbr> ( #{id,jdbcType=VARCHAR},</wbr>
<wbr><wbr>#{name,jdbcType=VARCHAR},</wbr></wbr>
<wbr><wbr>#{number,jdbcType=VARCHAR},</wbr></wbr>
<wbr><wbr>#{simpleName,jdbcType=VARCHAR},</wbr></wbr>
<wbr><wbr>#{description,jdbcType=VARCHAR},</wbr></wbr>
<wbr><wbr>#{createTime,jdbcType=DATE},</wbr></wbr>
<wbr><wbr>#{lastUpdateTime,jdbcType=DATE},</wbr></wbr>
<wbr><wbr>#{direct,jdbcType=NUMERIC}</wbr></wbr>
<wbr> ) <wbr></wbr></wbr>
<wbr> ]]&gt;</wbr>
<wbr>&lt;/insert&gt;;</wbr>

你可能感兴趣的:(mybatis)