Closed WangGithub0 closed 4 days ago
Because ran the basedata.sqlscript on the database has manually inserted records with IDs '1' and '2' into the CUSTOMER table. Since the code use the GenerationType.AUTO strategy for ID generation, MySQL is attempting to automatically generate the next available ID when try to insert a new record. However, this conflicts with the existing IDs manually inserted before.
Caused by: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '1' for key 'customer.PRIMARY' at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:118) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:916) at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1061) at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1009) at com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:1320) at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdate(ClientPreparedStatement.java:994) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197)