异常:HibernateOptimisticLockingFailureException StaleStateException
异常:
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
org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:675)
org.springframework.orm.hibernate3.SpringSessionSynchronization.translateException(SpringSessionSynchronization.java:160)
org.springframework.orm.hibernate3.SpringSessionSynchronization.beforeCommit(SpringSessionSynchronization.java:148)
org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95)
org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:927)
org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:737)
org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
com.supporter.prj.swf.service.WfDefProcService$$EnhancerByCGLIB$$ca7f2fa9.updateTransitionFilter(<generated>)
com.supporter.prj.swf.action.WfDefTransitionAction.saveAndNewFilter(WfDefTransitionAction.java:119)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation
...
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:85)
org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:70)
原因:entity关键字的生成策略为 assigned, 然后直接调用 dao.update(entity)造成的,应该先判断entity在数据库中是否存在,如果不存在使用dao.save ,如果存在使用 dao.update(entity)
- HibernateOptimisticLockingFailureException
- HibernateOptimisticLockingFailureException
- HibernateOptimisticLockingFailureException
- hibernate异常之--HibernateObjectRetrievalFailureException: No row with the given identifier exists
- HibernateObjectRetrievalFailureException异常问题!
- Hibernate 乐观锁 org.hibernate.StaleObjectStateException 异常
- nested exception isorg.hibernate.StaleObjectStateException
- hibernate异常 org.hibernate.StaleObjectStateException: Row was updated or deleted
- Hibernate 乐观锁 org.hibernate.StaleObjectStateException 异常
- 异常积累:org.hibernate.StaleStateException
- 主题:Hibernate 乐观锁 org.hibernate.StaleObjectStateException 异常
- org.hibernate.hql.ast.QuerySyntaxException is not mapped异常
- hibernate异常处理_NoResultException
- 解决weblogic抛出的ClassNotFoundException: org.hibernate.hql.ast.HqlToken异常
- Hibernate 悲观锁(Pessimistic Locking)和乐观锁(Optimistic Locking)
- Hibernate org.hibernate.TypeMismatchException异常
- org.hibernate.NonUniqueObjectException异常解决方法
- 异常类型:org.hibernate.PersistentObjectException: detached entity passed to persist异常
- Hibernate org.hibernate.TypeMismatchException异常 .
- Hibernate Gossip: 樂觀鎖定(Optimistic locking)