Multiple threads causing duplicate records in database
posted 3 years ago
We have a web service deployed on weblogic 10.3 running in clustered mode with 4 nodes in the cluster, which inserts data into oracle database. At times, when there are multiple same requests coming in at the same time, we see duplicate records getting inserted into database table. On applying synchronized keyword at the method level, it still inserts duplicate records (as the synchronized code does not work in application deployed in clustered environment).
Can anyone help me out with a possible approach ?
posted 2 years ago
karthik bhaskaran wrote:At times, when there are multiple same requests coming in at the same time, we see duplicate records getting inserted into database table.
Why would you be getting multiple same requests? Wouldn't each request have its own ID? You can put a constraint on the database table to ensure duplicate records are not inserted.