Error setting null for parameter #10 with JdbcType OTHER .
2014-02-23 11:00
239 查看
mybatis 插入空值時需要指定jdbcType
报错内容:
### Cause: org.apache.ibatis.type.TypeException: Error setting null for parameter #10 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property.
Cause: java.sql.SQLException: 无效的列类型
MyBatis 插入空值时,需要指定JdbcType
mybatis insert空值报空值异常,但是在pl/sql不会提示错误,主要原因是mybatis无法进行转换,
解决方法:
在insert语句中,增加jdbcType解决问题
<insert id="save" parameterType="Province">
<![CDATA[
insert into t_yp_province
(fid,fname,fnumber,fsimpleName,fdescription,fcreateTime,flastUpdateTime,fdirect)
values
( #{id,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR},
#{number,jdbcType=VARCHAR},
#{simpleName,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR},
#{createTime,jdbcType=DATE},
#{lastUpdateTime,jdbcType=DATE},
#{direct,jdbcType=NUMERIC}
)
]]>
</insert>;
报错内容:
### Cause: org.apache.ibatis.type.TypeException: Error setting null for parameter #10 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property.
Cause: java.sql.SQLException: 无效的列类型
MyBatis 插入空值时,需要指定JdbcType
mybatis insert空值报空值异常,但是在pl/sql不会提示错误,主要原因是mybatis无法进行转换,
解决方法:
在insert语句中,增加jdbcType解决问题
<insert id="save" parameterType="Province">
<![CDATA[
insert into t_yp_province
(fid,fname,fnumber,fsimpleName,fdescription,fcreateTime,flastUpdateTime,fdirect)
values
( #{id,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR},
#{number,jdbcType=VARCHAR},
#{simpleName,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR},
#{createTime,jdbcType=DATE},
#{lastUpdateTime,jdbcType=DATE},
#{direct,jdbcType=NUMERIC}
)
]]>
</insert>;
相关文章推荐
- Oracle数据库mybatis 插入空值时报错(with JdbcType OTHER)
- Error setting null for parameter #10 with JdbcType OTHER .
- Oracle数据库mybatis 插入空值时报错(with JdbcType OTHER)
- Error setting null for parameter #2 with JdbcType OTHER .(oracle)
- Error setting null for parameter #10 with JdbcType OTHER .
- Error setting null for parameter #2 with JdbcType OTHER
- Error setting null for parameter #2 with JdbcType OTHER
- org.apache.ibatis.type.TypeException: Error setting null for parameter #1 with JdbcType OTHER
- Oracle数据库mybatis 插入空值时报错(with JdbcType OTHER)
- Oracle数据库mybatis 插入空值时报错(with JdbcType OTHER)
- JDBC操作MySQL出现:This result set must come from a statement that was created with a result set type of ResultSet.CONCUR_UPDATABLE, ...的问题解决
- JDBC操作存储过程错误:必须说明 'QUERYCHARGESTATWITHNETTYPE' 组件
- A const field of a reference type other than string can only be initialized with null Error [duplicate]
- mybatis的jdbcType和javaType、oracle,MySQL的对应类型
- Java出现No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- MyBatis 通过包含的jdbcType类型
- A web application created a ThreadLocal with key of type [null]
- No Dialect mapping for JDBC type: -9解决方法
- Resource interpreted as Stylesheet but transferred with MIME type application/x-css
- mybatis常用jdbcType数据类型