-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Concurrent Data Insertion Problem, Primary Key Duplicated
PostPosted: Sat Feb 26, 2005 12:33 am 
Newbie

Joined: Sun Jul 18, 2004 11:54 pm
Posts: 2
Hibernate version: 2.1
MySQL 5.0 Alpha

Dear All,

I'm having a problem in inserting a new record concurrently. The following is the the scenario:

1. I have two users (User A and User B) running same application Z on two
separate PCs.

2. User A and User B runs the application Z at the same time, same module
X. And here is the complicated part.


Quote:
User A and User B both "entered their client data" and "saved it one after the another". The error as the following appeared:

"Duplicate key or integrity constraint violation".

This problem was found when they seem to access the same table and started adding data from the same row:

1. When both of them access the database at table XYZ,
hibernate found the last row is at row 10 (for user A and user B).

2. When both the user saves the data, the error appears and user B have
his/her data intact and user B lost his data.

Kind Regards,
Dragoncity99


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 26, 2005 3:12 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
generate id on server ("sequence" is the best way)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.