Actually your assumption that the first user who executes step 3 wins is not always
correct. May be most of the time it happens that way for your case.
It has to be that the first of the two treads which does a hibernateSession.flush() will
win. This is a desired behaviour from hibernate, and this is a very important feature.
I think the solution you thought of catching StaleObjectStateException is fair enough.
Make sure that your "try" boundary is the smallest possible so that you do not
catch StaleObjectStateException happening because of some other reason.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4265649#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...