Hello,
We have a requirement where we generate a unique number to the customer. The number generation criteria is that, look for the recently created unique number in DB, increment it by 1 and then persist it to the DB. All these rules are carried out in the Button Submit. The Problem here is, when two users Submit the Form at the same time then the Same unique number(Actually Duplicates) is created for them. Is there someway to prevent this ?
Thanks
Discussion posts and replies are publicly visible
Hi nandinib0001
I have couple of quick question to better understand about the various approaches you have tried.
Few suggestions
Hope this will help you in debugging and resolving this.
You need to look at what locking mechanisms are in place or available for the database that you're using. Locking means that even if two transactions appear to be concurrent only one can take place at a time, so this will solve the issue that you're concerned about.