Duplicate entry '5' for key 'PRIMARY'

错误:

17:31:56,649  WARN org.hibernate.util.JDBCExceptionReporter:100 - SQL Error: 1062, SQLState: 23000

17:31:56,653 ERROR org.hibernate.util.JDBCExceptionReporter:101 - Duplicate entry '5' for key 'PRIMARY'
17:31:56,656 ERROR org.hibernate.event.def.AbstractFlushingEventListener:324 - Could not synchronize database state with session

org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update


原因: mysql数据库中已经存在了主键为5的列。所以出错了。

你可能感兴趣的:(sql,数据库,mysql,jdbc,database)