This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Just want to know that in Hibernate when is this error happens?
Caused by: org.hibernate.StaleStateException: Batch update returned unexpected row count from update ; 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.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:24) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2353) at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2257) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2557) at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:92) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140) 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.springframework.orm.hibernate3.HibernateTemplate$27.doInHibernate(HibernateTemplate.java:806) at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367) at org.springframework.orm.hibernate3.HibernateTemplate.flush(HibernateTemplate.java:804)
Tried to look at the API, and it says
/** * Thrown when a version number or timestamp check failed, indicating that the * <tt>Session</tt> contained stale data (when using long transactions * with versioning). Also occurs if we try delete or update a row that does * not exist.<br> * <br> * Note that this exception often indicates that the user failed to specify the * correct <tt>unsaved-value</tt> strategy for a class!
Did I miss something here? I was just trying to remove a persistent object and then add a new persistent object, wherein, both objects have the same superclass (@MappedSuperClass), there, I have the version field contain in the superclass. Is there anything wrong here?
Any help is appreciated. Thanks.
Joined: Sep 21, 2006
I should not have called the session.clear() executed by flush() from my source. Session clear, cancels all your pending transactions. Thus, reference to previous object after clear() is already stale.
I am a little confused. Your name shows as ayan, but you ended you post with "Cheer bryan", not that there is much difference, "a" versus "br" before the "yan" acually the difference between the two are two different html tags.