StaleObjectStateException « Transaction « JPA Q&A

1. Hibernate - StaleObjectStateException in query possible?

Is it possible to get a StaleObjectStateException with Hibernate when you do the same query twice inside one tx if the result data of that query gets changed by a concurrent ...

2. How to overcome StaleObjectStateException in grails Service

I've introduced a TransactionService that I use in my controllers to execute optimistic transactions. It should

  • try to execute a given transaction (= closure)
  • roll it back if it fails and
  • try it again ...

3. Hibernate (JPA): how to handle StaleObjectStateException when several object has been modified and commited

Consider the scenario: A Db transaction envolving more than one row from different tables with versioning. For example: A shopLists and products. Where a shopList may contain products (with their amount in the shoplist) ...

4. Optimistic locking and org.hibernate.StaleObjectStateException:

I'm just experimenting with Optimistic locking. I have the following class:

public class Student {

    private Integer id;
    private String firstName;
    private String lastName;

5. Avoid StaleObjectStateException when deleting entity

I have 2 concurrent threads that at the same time enter a (Spring) transaction service. Using Hibernate, the service method loads some entities, processes those, finds one and deletes it from the ...

6. How to prevent StaleObjectStateException on Query.list()?

I use Hibernate optimistic locks in my software (via @Version annotation). It works quite well, but sometimes I get StaleObjectStateException while trying to merely retrieve some objects from database. How can ...

7. Grails performance test error : org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction

I'm preparing for performance tests and creating new test cases. So I was just testing one test case, running it on a server I can only access and I just got: org.hibernate.StaleObjectStateException: Row ...

8. StaleObjectStateException after tx-rollback in jboss

hi, we use hibernate 2 with jboss datasources. if there is a foreign-key conflict in the database while deleting some db-entries, jboss rolls back the transaction. in our application i put session.delete(query) in a try and session.flush() in a finally block. after rollback i get a StaleObjectStateException in session.flush(). can you help me to prevend this? greetings from berlin, daniel.

9. FYI: Handling concurrency errors (StaleObjectStateException)

Beginner Joined: Wed Nov 26, 2003 11:53 am Posts: 26 Location: Netherlands Hello all, I thought I'd share my experiences with the community: for a lot of issues there are only questions, but few answers in the forums... A StaleObjectStateException does not mean that there is something "wrong", it is a logical extension of optimistic locking. When a version check fails ...

10. Rollback 's problem after StaleObjectStateException

Hibernate version: 2.1.8 Mapping documents:

11. concurrent updates without StaleObjectStateException

I've set up versioning for my test application (I can see version number being increased after each updates) and I'm executing the following method in two threads : Code: public void run() { logger.trace("Thread ID : " + Thread.currentThread().getId()); Session session = hibertest.sessionFactory.openSession(); Transaction transaction = session.beginTransaction(); ...