I am using transactions in a solution where the clients can edit records and the data will be saved only at request (all the forms where data can be edited have this functionality)
What happens is that when 2 or more clients are on the same record at the same time, with the transaction being active, obviously, a deadlock occurs.
I tried to fix this using locks, but they want to commit the transaction only at request, so even if I unlock the record onRecordSave, I cannot commit the transaction and the deadlock occurs anyway.
For example, the user edits a record and then clicks outside the field; the record is saved and the lock is released, then he goes to the previous record, which has a lock on it (it is locked by the other client). The other user will release the lock on this record and then they will both be in the same record, one client being frozen(the one who had the lock) and the other getting a message that ‘You do not have access to modify this data…’, just like if this record would be locked by the other client (which is not the case). Transactions are active on both sides.
Could anyone point me in the right direction on how to achieve the functionality that records are saved only at request (throughout the whole application), and that deadlocks do not appear?