Unable to create review due to error 'ConstraintViolationException - Could not execute JDBC batch update'

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Symptoms

Fisheye/Crucible is using MySQL server.

Creating review fail with the following error in the atlassian-fisheye-<date>.log:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2013-01-25 14:59:12,690 WARN [btpool0-48 ] org.hibernate.util.JDBCExceptionReporter JDBCExceptionReporter-logExceptions - SQL Error: 1062, SQLState: 23000 2013-01-25 14:59:12,690 ERROR [btpool0-48 ] org.hibernate.util.JDBCExceptionReporter JDBCExceptionReporter-logExceptions - Duplicate entry 'Test-87197-46448' for key 'cru_source_name' 2013-01-25 14:59:12,690 ERROR [btpool0-48 ] org.hibernate.event.def.AbstractFlushingEventListener AbstractFlushingEventListener-performExecutions - Could not synchronize database state with session org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275) ... Caused by: java.sql.BatchUpdateException: Duplicate entry 'Test-87197-46448' for key 'cru_source_name' ... Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'Test-87197-46448' for key 'cru_source_name' ... 2013-01-25 14:59:12,690 WARN [btpool0-48 ] fisheye TxHelper-rollbackTxIfNotCommitted - Rolled back transaction started from: -> com.atlassian.crucible.actions.BaseAction.beginTx(BaseAction.java:161) -> com.atlassian.crucible.actions.create.CreateReviewFromChangesetAjaxAction.execute(CreateReviewFromChangesetAjaxAction.java:496) -> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) -> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) -> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 2013-01-25 14:59:12,690 DEBUG [btpool0-48 ] fisheye RepositoryHandle-release - release engine on Test, count=0 2013-01-25 14:59:12,690 ERROR [btpool0-48 ] fisheye TotalityFilter-logExceptionDetails - Exception "org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update" (javax.servlet.ServletException) while processing "/cru/create.do" (Referer:"https://jira.intelliflo.com/browse/TEST-1657") javax.servlet.ServletException: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at com.opensymphony.webwork.dispatcher.DispatcherUtils.serviceAction(DispatcherUtils.java:284) at com.opensymphony.webwork.dispatcher.ServletDispatcher.service(ServletDispatcher.java:111)

Diagnosis

Run the following SQL command:

1 SHOW CREATE DATABASE databasename; 

Check that if it is using utf8_bin collation as stated Migrating to MySQL.

Cause

Your database is not using case sensitive collation that is needed by Fisheye/Crucible.

Solution

Resolution

  1. Backup Fisheye/Crucible, Backing up and restoring Fisheye data

  2. Recreate your database with utf8_bin collation, About database encoding

  3. Restore the backup into Fisheye/Crucible

Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.