I have a complex business web application that receives multiple concurrent requests. One of those requests is to process a new invoice. If multiple of these requests are received at the same time, at least one of the requests will suffer a rollback because of the following error Transaction (Process ID X) was deadlocked on lock resources
.
I have been browsing through lots of StackOverflow entries about this topic, but none of them have given me a solution. I tried turning on SNAPSHOT ISOLATION
, but nothing changed. I have try reordering my code, but to no avail. User https://stackoverflow.com/users/1560836/user1560836 commented on Correct way to handle deadlocks in Hibernate that there simply was no solution to this issue, and it seems likely. Still, I find it hard to believe, given how used these frameworks are.
Does anybody have a recommendation or maybe a solution? Also, do you have a solution to at least monitor these occurrences? Any help would be greatly appreciated.