利用hibernate 的save() 插入数据0 actual row count: 0 expected: 1

本文记录了一个使用Springside框架结合Hibernate3和Struts2.0进行开发时遇到的StaleStateException异常,具体表现为更新操作返回的行数与预期不符,实际为0,期望为1。文章提供了出现问题的hbm.xml配置文件及Action代码段,寻求解决此问题的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我用的springside+hibernate3+struts.2.0开发的
已经调了很长时间 找不到解决方法;谢谢:

一直在待回帖
2007-08-16 15:36:33,531 ERROR [org.hibernate.jdbc.AbstractBatcher] - <Exception executing
batch: >
org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1
at org.hibernate.jdbc.BatchingBatcher.checkRowCount(BatchingBatcher.java:93)
at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:79)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:230)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(Abstrac
tFlushingEventListener.java:296)


[color=red]我的hbm。xml[/color]

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="com.cnc.oa.domain.TProMd5" table="t_pro_md5" catalog="oa">
<id name="processId" type="java.lang.String" unsaved-value="null">
<column name="processID" length="50" />
<generator class="assigned" />
</id>
<property name="mdproId" type="java.lang.String">
<column name="mdproID" length="50" not-null="true" />
</property>
<property name="formcode" type="java.lang.Integer">
<column name="formcode" not-null="true" />
</property>
</class>
</hibernate-mapping>

[color=red]
我的action 调用save后就报上面的错 [/color]
public class SendDocmentInfoAction extends BaseAction{
public String save(){
try{

tProMd5 = new TProMd5();
tProMd5.setFormcode(formcode);
tProMd5.setProcessId(proId);
tProMd5.setMdproId(unid);
);
[color=darkred]//能得到formcode +proId unid [/color]
System.out.println("md5save" +formcode +proId +unid);


sendDocmentMd5Manager.save(tProMd5);

}catch(Exception e){
e.printStackTrace();
return INPUT;
}
saveMessage("数据" + (id == null ? "新增" : "保存") + "成功!");
return SUCCESS;
}
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值