On our web site we have two operations which work against the same table, one does a read of multiple rows and the other deletes a row.
We’re using Spring 3.1 and Hibernate 3.6.
The exact operations are
EntityManager.createQuery().getResultList();
and
EntityManager.remove();
We are getting the StaleObjectStateException on the remove() thread, not on the getResultList() thread. The question is, why would a read cause a StaleObjectException?
The underlying cause of this problem turned out to be completely unrelated to Hibernate or Spring, it was an HTML/Javascript problem that was causing two separate HTTP requests to be sent every time the link in question was clicked. (Both requests were edits, so that was the source of the conflict.)
Just putting this answer out here so that people will know that Spring and Hibernate DO work.