Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple threads causing duplicate records in database

 
karthik bhaskaran
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

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 ?

Thanks
Karthik
 
Abhinav Sonkar
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic