I have an HTML page to confirm items for a goods transfer.
In it, jQuery, AJAX is used with the option async: false
and VRaptor.
I did the following test:
- I created a multi-item download.
- After downloading, I went to the confirmation screen to confirm receipt of the items.
- I confirmed all of them and clicked the end button. This button triggers the event that scans the screen and sends the parameters of the confirmed items (such as PK keys) to the server that will persist the data.
The process works correctly when a user is logged in using a browser.
The problem happens when the logged-in user resolves to use two browsers and clicks the 'finish' button in both browsers. This generates duplicate records in the database.
How can I solve the problem, since I can not have a lock for the same user, and if it uses two browsers (same or not), prevent it from duplicating records in the database?