Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Exception: Can't write; duplicate key in table '#sql-948_1fc'
Exception: Can't write; duplicate key in table '#sql-948_1fc' [message #1423127] Sat, 13 September 2014 20:05 Go to next message
Eclipse UserFriend
Hi all,
I get a lot of the following Exceptions when my applications starts:

[EL Warning]: 2014-09-14 01:49:15.005--ServerSession(8488715)--Exception
[EclipseLink-4002] (Eclipse Persistence Services -
2.5.2.v20140319-9ad6abd):
org.eclipse.persistence.exceptions.DatabaseException
Internal Exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
Can't write; duplicate key in table '#sql-948_1fc'
Error Code: 1022
Call: ALTER TABLE MY_TABLE ADD CONSTRAINT FK_MY_TABLE_FK_FOREIGNTAB
FOREIGN KEY (FK_FOREIGNTAB) REFERENCES MY_TABLE (ID)
Query: DataModifyQuery(sql="ALTER TABLE MY_TABLE ADD CONSTRAINT
FK_MY_TABLE_FK_FOREIGNTAB FOREIGN KEY (FK_FOREIGNTAB) REFERENCES
MY_TABLE (ID)")


The application then runs correctly, but I don't know how to eliminate
this Exception. How could I do this?

My persistence properties:

<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="eclipselink.ddl-generation"
value="create-or-extend-tables" />
<property name="eclipselink.logging.level" value="FINE" />
</properties>


Any hints are welcome...

TIA,
Ralf.
Re: Exception: Can't write; duplicate key in table '#sql-948_1fc' [message #1425667 is a reply to message #1423127] Wed, 17 September 2014 12:59 Go to previous messageGo to next message
Eclipse UserFriend
The exception is a normal occurrence when running DDL on a database that already has tables and foreign keys defined, and is only logged at the warning level. You can avoid it by not using the create-or-extend DDL generation, or turn down the log level.

https://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging
Re: Exception: Can't write; duplicate key in table '#sql-948_1fc' [message #1729964 is a reply to message #1425667] Wed, 20 April 2016 10:54 Go to previous message
Eclipse UserFriend
The problem is that Mysql is very slow to throw this error, so startup performance is greatly affected by this. It would be very useful to have this alter table output to a file instead to database so we can execute only the part we want.
Previous Topic:DDL Generation: Output alter table to a file (only to file)
Next Topic:weaving errors with eclipseLink 2.6.2
Goto Forum:
  


Current Time: Sat Jul 05 07:08:06 EDT 2025

Powered by FUDForum. Page generated in 0.03136 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top