Hi all,
I'm experimenting a problem of unique contraint violation when trying to insert in a table.
I need at an application level to make sure that an instance of a table called X here won't be modified by both client at the same time, so I have implemented kind of a lock process.
So before a client try to modify an instance of X, it checks before if there is an entry in the locktable referencing the instance of X.
If not, it inserts a entry into the locktable and delete it after having finished. My problem is that between the moment where I check if there is an entry in X and if not the moment where I do commit the insert of the entry in X, another client has already inserted one entry, so I get a constraint violation.
The question is there another way except handling the exception and trying again a few moment later to do this, I mean kind of a table locking stuff?
Vlad
|