Hi we have a front end that uploads a file to the server, each of these uploads happens simultaneously via AJAX. This triggers a function which finds an order that the file has to be associated to, and enters the files id into a table. But since there are several files being uploaded at the same time the table that contains these id's are being overwritten, which results in not all files are associated with the order in this way.
LockForUpdate does only seem to make the problem worse with more files that are not put into the table. The reason for the saving the file in the table is that we need the different files in different situations, which the order table contains currently.
I really dont understand this part: "But since there are several files being uploaded at the same time the table that contains these id's are being overwritten"
Why not use an incrementing ID in that table, you upload the file, insert it into the table, get a unique ID back, and do the rest with that.