ITeye博客

StaleStateException和HibernateOptimisticLockingFailureExcepti

weishuwei · 2007-03-10 17:44 · hibernate&ibatis · Markdown

更新东西时出现错误,
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.Expectations$BasicExpectation.checkBatched(Expectations.java:61)

ERROR [com.opensymphony.webwork.dispatcher.DispatcherUtils] - Could not execute action
 org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1; nested exception is org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

备注:持久化对象的主键是我们自定义的IdGenerator.java
解决方案:因为用到了freemarker,传入的id被freemarker默认定科学计数法定义格式如下:1,000,222,555,;我们定义id?c;这样得到的id格式如下:1000222555,问题得以解决.

后话:
问题是解决了,但出错提示有点奇怪,这一点有待解决.

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。