org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

Hibernate JIRA | Brett Meyer | 4 years ago
  1. 0

    org.hibernate.test.component.basic.ComponentTest testComponent testComponentStateChangeAndDirtiness testCustomColumnReadAndWrite All fail on mssql2008 and mssql2012 with the following stacktrace (testComponent as an example): {code} 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:82) at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:73) at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:59) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3216) at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3118) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3447) at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:140) at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:354) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:276) at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:327) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1234) at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404) at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101) at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175) at org.hibernate.test.component.basic.ComponentTest.testComponent(ComponentTest.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:63) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:62) {code}

    Hibernate JIRA | 4 years ago | Brett Meyer
    org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
  2. 0

    org.hibernate.test.component.basic.ComponentTest testComponent testComponentStateChangeAndDirtiness testCustomColumnReadAndWrite All fail on mssql2008 and mssql2012 with the following stacktrace (testComponent as an example): {code} 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:82) at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:73) at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:59) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3216) at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3118) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3447) at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:140) at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:354) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:276) at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:327) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1234) at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404) at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101) at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175) at org.hibernate.test.component.basic.ComponentTest.testComponent(ComponentTest.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:63) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:62) {code}

    Hibernate JIRA | 4 years ago | Brett Meyer
    org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
  3. 0

    Java ERROR TaskUtils$LoggingErrorHandler:95 - Unexpected error occurred in scheduled task

    Stack Overflow | 2 years ago | Rachel Geller
    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
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    why saveOrUpdate doesn't insert note in database when it executes if I use save

    Stack Overflow | 3 years ago | homeAccount
    org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
  6. 0

    Hibernate delete record miserably fails

    Stack Overflow | 3 years ago | PerfectGundam
    org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

  1. kuldeep 8 times, last 2 months ago
5 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. 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()
  2. Hibernate
    AbstractTransactionImpl.commit
    1. org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:82)
    2. org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:73)
    3. org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:59)
    4. org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3216)
    5. org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3118)
    6. org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3447)
    7. org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:140)
    8. org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)
    9. org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:354)
    10. org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:276)
    11. org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:327)
    12. org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
    13. org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1234)
    14. org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404)
    15. org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
    16. org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)
    16 frames
  3. org.hibernate.test
    ComponentTest.testComponent
    1. org.hibernate.test.component.basic.ComponentTest.testComponent(ComponentTest.java:129)
    1 frame
  4. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:601)
    4 frames
  5. JUnit
    FrameworkMethod.invokeExplosively
    1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    3 frames
  6. A Hibernate O/RM Module
    ExtendedFrameworkMethod.invokeExplosively
    1. org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:63)
    1 frame
  7. JUnit
    FailOnTimeout$StatementThread.run
    1. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    2. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    3. org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
    4. org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:62)
    4 frames