Are you using MySQL's autoincrement feature for the PKs or the auto_pk_support table from Cayenne?
-----Original Message----- From: Christian Mittendorf [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 12, 2006 4:29 AM To: [email protected] Subject: Duplicate Key Problem Hello! We are running a MySQL 5.0 server using InnoDB tables for our applications. We have multiple web applications accessing this same database and the system is running smooth and without problems (almost). But yesterday we were experiencing some strange errors. During the afternoon some CayenneRuntimeExceptions appeared in the log file, which were caused by: Caused by: java.sql.SQLException: null, message from server: "Duplicate entry '4353880' for key 1" A bit later other CayenneRuntimeException appeared. For those exceptions the cause was: Caused by: java.sql.SQLException: Deadlock found when trying to get lock; Try restarting transaction, message from server: "Lock wait timeout exceeded; try restarting transaction" I'm now wondering, are both errors related to each other? There are, from my point of view, two possible causes for the "Duplicate entry..." message: - two Insert statements on the same object, which might be possible if the application is clustered, which our applications are not, or - dual use of the same key in different objects Has anybody else experienced something like that? Are there any hints what I might do to avoid such situations? Christian
