日期:2014-05-19  浏览次数:20687 次

data truncation异常 ibatis,Sql server2000
关于iBatis更新数据的错误
product.xml配置
<typeAlias alias="product" type="com.product.pojo.Product"/>
<resultMap id="pojo-product" class="product">
<result property="id" column="id"/>
<result property="name" column="proName"/>
<result property="typleName" column="typleNum"/>
<result property="typleStr" column="typleNumStr"/>
<result property="typle" column="typle"/>
<result property="technum" column="technum"/>
<result property="casingnum" column="casingnum"/>
<result property="part" column="part"/>
<result property="proIntro" column="intro"/>
<result property="remark" column="remark"/>
<result property="date" column="proDate"/>
<result property="picurl" column="pic"/>
</resultMap>
<parameterMap id="into-pro" class="product">
<parameter property="name" jdbcType="VARCHAR" javaType ="java.lang.String"/>
<parameter property="typleName" jdbcType="VARCHAR" javaType ="java.lang.String"/>
<parameter property="typleStr" jdbcType="VARCHAR" javaType ="java.lang.String"/>
<parameter property="typle" jdbcType="VARCHAR" javaType ="java.lang.String"/>
<parameter property="technum" jdbcType="VARCHAR" javaType ="java.lang.String"/>
<parameter property="casingnum" jdbcType="VARCHAR" javaType ="java.lang.String"/>
<parameter property="part" jdbcType="VARCHAR" javaType ="java.lang.String"/>
<parameter property="proIntro" jdbcType="VARCHAR" javaType ="java.lang.String"/>
<parameter property="remark" jdbcType="VARCHAR" javaType ="java.lang.String"/>
<parameter property="date" jdbcType="DATE" javaType="java.util.Date"/>
<parameter property="picurl" jdbcType="VARCHAR" javaType="java.lang.String"/>
</parameterMap>
<update id="updateProduct" parameterClass="product">
update product set proName=#name#,typleNum=#typleName#,
typleNumStr=#typleStr#,typle=#typle#,technum=#technum#,casingnum=#casingnum#,
part=#part#,intro=#proIntro#,remark=#remark#,proDate=#date#,pic=#picurl# where id=#id#
</update>
数据库product
create table product(
id int IDENTITY (10001,1),
proName varchar(50),
typleNum varchar(50),
typleNumStr varchar(50),
typle varchar(50),
technum varchar(300),
casingnum varchar(300),
part varchar(300),
intro varchar(500),
proDate datetime,
remark varchar(200),
pic varchar(100),
primary key(id)
);
我对每个字段都trim了,在更新数据的时候,偶尔会出现
com.ibatis.common.jdbc.exception.NestedSQLException
--- The error occurred in com/abaisse/system/mapping/RActions.xml. 
--- The error occurred while applying a parameter map. 
--- Check the saveAction-InlineParameterMap. 
--- Check the statement (update failed). 
--- Cause: java.sql.DataTruncation: Data truncation 
Caused by: java.sql.DataTruncation: Data truncation
这个异常,有时修改会出现把别的数据复制给我修改的数据(修改的数据没有复制)。这些情况