I just wanted to write about what was happening to me with this exception: net.sf.hibernate.StaleObjectStateException. It threw this message:
Row was updated or deleted by another transaction
I think that this exception can be thrown in this case and I was going mad with it:
1) Open a session to make an hibernate query
2) Execute a query wich returns a result (using the session, of course). Suppose I am getting a collection of 'Orders', for example.
3) Make a new insertion using the session. This insertion changes the result of the previous query. With the same example, suppose I have inserted in the session a new 'Order'
4)Using the same session again, execute the same query that in 2)
The exception is thrown then.
I hope it helps to someone.
|