个人随笔
目录
hibernate异常:Caused by: org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
2021-07-02 17:13:08

系统批处理程序进程报这个错误,没想到是因为我Hibernate先读取了数据,然后该数据被别的线程删了,然后我当前线程再去删除就报这个错误了!找了半天!

  1. 2021-07-02 17:09:33,368 [Thread-7] INFO [org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl] - HHH000010: On release of batch it still contained JDBC statements
  2. org.springframework.orm.hibernate4.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
  3. at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:203)
  4. at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:681)
  5. at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:563)
  6. at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757)
  7. at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)
  8. at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:478)
  9. at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:272)
  10. at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
  11. at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
  12. at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
  13. at com.sun.proxy.$Proxy24.executeJKXXInfo(Unknown Source)
  14. at com.wyx.MyTask.run(StartDeal.java:169)
  15. Caused by: org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
  16. at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:81)
  17. at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:73)
  18. at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:57)
  19. at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3132)
  20. at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3335)
  21. at org.hibernate.action.internal.EntityDeleteAction.execute(EntityDeleteAction.java:91)
  22. at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)
  23. at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:354)
  24. at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:280)
  25. at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326)
  26. at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
  27. at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1127)
  28. at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:325)
  29. at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
  30. at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)
  31. at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:555)
  32. ... 9 more
 852

啊!这个可能是世界上最丑的留言输入框功能~


当然,也是最丑的留言列表

有疑问发邮件到 : suibibk@qq.com 侵权立删
Copyright : 个人随笔   备案号 : 粤ICP备18099399号-2