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
展开
1个回答
展开全部
Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1 at 可以看出。。在执行UPDATE时候本来是可以执行一条的,但现在是没有一条的,说明你你在SAVE之前应该根据某个ID标识符提取个代理对象也就是GET()、load(),查看下。。或者是UPDATE方法。。都找找
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询