关于Hibernate继承映射抛出的异常(一个类一张表)

Exceptioninthread"main"org.hibernate.StaleStateException:Batchupdatereturnedunexpecte... Exception in thread "main" org.hibernate.StaleStateException: Batch update returned unexpected row count from update [1]; actual row count: 0; expected: 1
at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:61)
at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:46)
at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:68)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:145)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at com.xie.ManyToOne.add(ManyToOne.java:121)
at com.xie.ManyToOne.main(ManyToOne.java:22)
hbm.xml配置如下:
<hibernate-mapping package="com.xie.domain">
<class name="Employee" >
<id name="id">
<generator class="hilo"/>
</id>
<property name="name" unique="true"/>
<many-to-one name="depart" column="depart_id"/>
<union-subclass name="Skiller" table="skiller">
<property name="skill"/>
</union-subclass>
<union-subclass name="Sales" table="sales">
<property name="sell"/>
</union-subclass>
</class>
</hibernate-mapping>
请问问题出在哪儿??
展开
 我来答
eeqqgg
2011-08-29
知道答主
回答量:17
采纳率:0%
帮助的人:7.8万
展开全部
StaleStateException这个异常应该是不是在同一个session中管理所以导致这种错误
session处理的对象不是persistent对象
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式