iBatis对BLOB数据读写,但update不成功
map.xml的配置
<resultMap id="pojo-product" class="product">
<result property="id" column="id"/>
<result property="name" column="proName"/>
<result property="typleName" column="typleNum"/>
<result property="typle" column="typle"/>
<result property="proMaker" column="maker"/>
<result property="date" column="proDate"/>
<result property="pic" column="pic" jdbcType="BLOB" javaType="[B"/>
</resultMap>
<parameterMap id="into-pro" class="product">
<!-- <parameter property="id" jdbcType="VARCHAR" javaType ="java.lang.String"/> -->
<parameter property="name" jdbcType="VARCHAR" javaType ="java.lang.String"/>
<parameter property="typleName" jdbcType="VARCHAR" javaType ="java.lang.String"/>
<parameter property="typle" jdbcType="VARCHAR" javaType ="java.lang.String"/>
<parameter property="proMaker" jdbcType="VARCHAR" javaType ="java.lang.String"/>
<parameter property="date" jdbcType="DATE" javaType="java.util.Date"/>
<parameter property="pic" jdbcType="BLOB" javaType="[B"/>
</parameterMap>
<insert id="insertProduct" parameterClass="product" parameterMap="into-pro">
insert into product(id,proName,typleNum,typle,maker,proDate,pic)
values(PRO_ID_SEQ.nextval,?,?,?,?,?,?)
</insert>
<update id="updateProduct" parameterClass="product">
update product set pic=#pic# , proName=#name#,typleNum=#typleName#,
typle=#typle#,maker=#proMaker#,proDate=#date# where id=#id#
</update>
DAO处理
sqlMap.startTransaction();
sqlMap.update("updateProduct", pro);//pro是传进去的Product类的对象
sqlMap.commitTransaction();
Product类
public class Product implements Serializable {
private int id;
private String name;
private String typleName;
private String typle;
private String proMaker;
private Date date;
private byte[] pic;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTypleName(){
return typleName;
}
public void setTypleName(String typleName){
this.typleName = typleName;
}
public String getTyple(){
return typle;
}
public void setTyple(String typle){
this.typle = typle;
}
public String getProMaker(){
return proMaker;
}
public void setProMaker(String proMaker){
this.proMaker = proMaker;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public byte[] getPic() {
return pic;
}
public void setPic(byte[] pic) {
this.pic = pic;
}
}
insert和delete,update都成功,
就是每次的update都不成功,没有报错和异常。
希望哪位高手帮忙解决下。
最好能给出map.xml中update的配置代码。
------解决方案--------------------
代码看没问题,是不是没有满足你update的条件的,或者你跟新的内容和原来的一样。你仔细看看。