MySQL - 空表上的重复输入错误

时间:2014-06-03 18:07:07

标签: mysql jpa

我试图通过我的Java应用程序(JPA / EclipseLink)将记录插入MySQL数据库。插入具有两列主键(CM_MAC_ADDRESS和CHANGE_ID)的表时,我收回此错误:

javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'BATCH1-AA:BB:CC:DD' for key 'PRIMARY'
Error Code: 1062
Call: INSERT INTO CONVERGENCE.MODEM (CBS_ACCOUNT_ID, CM_IP, DX_SERVICE_LEVEL, IS_PILOT, MODEL, CM_MAC_ADDRESS, CHANGE_ID, OPTICAL_RECEIVER_NAME) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
bind => [8 parameters bound]
Query: InsertObjectQuery(Change ID=BATCH1, CM MAC=AA:BB:CC:DD)

奇怪的是,这个表是空的:

mysql> select * from MODEM;
Empty set (0.00 sec)

所以它不可能是一个重复的密钥。为什么还会抛出这个错误?

0 个答案:

没有答案