The Answer to Life, the Universe, and Everything

Thursday, January 08, 2009

ERROR JDBCExceptionReporter - Duplicate entry

By using mysql, I faced the followin error and here is the solution
2009-01-08 22:55:18,454  WARN JDBCExceptionReporter - SQL Error: 1062, SQLState: 23000
2009-01-08 22:55:18,454 ERROR JDBCExceptionReporter - Duplicate entry '268731' for key 1
2009-01-08 22:55:18,454 ERROR AbstractFlushingEventListener - Could not synchronize database state with sessi
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update


Close the session after transaction.commit().
transaction.commit();
session.flush();
session.close();

No comments: