hi,
I'm trying to understand what are the difference between StaleStateException and StaleObjectStateException, but I'm confusing a bit.
I have this situation:
classA 01-----* classB
1) load a1 (instance of classA) in session1. load b17 (instance of classB) in session1. Add b17 to a1.
b17 is removed from db by session2.
associate b17 with a1 and then session1.update()
session1.flush() throw StateStaleException
2) load a1 (instance of classA) in session1.
b2 (instance of classB already associated with a1) is removed in session2.
do some changes on a1 and then session1.update()
session1.flush() not throw any Exception -> OK
3) load b5 in session1.
b5 is removed in session2.
some changes on b5 and then session1.update()
session1.flush() throw StateStaleException
How can I reproduce StaleObjectStateException? or when does it occur?
|