I am working on a large application that manages complex "events" with quite a lot of data.
The application is broken down into a client (mainly in C #, mainly on .NET 2.0), a WCF-based server designed to work in IIS (web services at this level), and the back of the data, which is NHibernate-based MS SQL Server Database.
We encounter an error in the following scenario:
Several users (in this case 6 in our testing) simultaneously store a permanent object on the client (for example, an event). (This is done through a verbal countdown, so we are talking about the difference in a second or in connection with the reaction time)
When they store objects on the client, the client calls the server to save this object. The server runs any business logic and then makes the change through NHibernate.
In this situation (multiple persistence over service calls), some clients return with an unprepared exception:
"Row updated or deleted by another transaction"
This is an exception to NHibernate.
In my research, I found several examples of this error, but have always been consistent. Our application is executed sequentially, this only happens while saving.
How should I protect multiple concurrent NHibernate transactions from each other?
(This will be a large-volume application, so the minimum required lock is good. We cannot afford to lock all saved files.)
NHibernate, ? ? , , ?
, , , /. ?
: .
, , , , , , . ( ).
, , , , :
. ( ). , , . , , ( ) , , , , , .
?