hibernate 查询的时候正常就是save的时候提示错误数据库mysql 以下是错误提示和源代码 高手帮看看啊

错误提示Exceptioninthread"main"org.hibernate.StaleStateException:Batchupdatereturnedunexp... 错误提示 Exception in thread "main" 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:92) at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:78) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:174) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86) at com.free.dome01.PersonOperate.insert(PersonOperate.java:41) at com.free.dome01.TestPO.main(TestPO.java:21) 数据库 CREATE TABLE person ( id varchar(32) not null primary key , name varchar(20) not null , password varchar(20) not null , sex varchar(2) , email varchar(30) ) ; Person.hbm.xml <?xml version="1.0" encoding='UTF-8'?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" > <!-- DO NOT EDIT: This is a generated file that is synchronized --> <!-- by MyEclipse Hibernate tool integration. --> <!-- Created Thu Nov 09 16:06:12 CST 2006 --> <hibernate-mapping package="com.free.dome01"> <class name="Person" table="PERSON"> <id name="id" column="ID" type="string"> <generator 展开
 我来答
小小ER他
2012-01-05 · 超过22用户采纳过TA的回答
知道答主
回答量:95
采纳率:0%
帮助的人:34.9万
展开全部
Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1 at 可以看出。。在执行UPDATE时候本来是可以执行一条的,但现在是没有一条的,说明你你在SAVE之前应该根据某个ID标识符提取个代理对象也就是GET()、load(),查看下。。或者是UPDATE方法。。都找找
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式