Getting "unique constraint violated" messages when running BRMS 5.3.x on EAP 6
Environment
- Red Hat JBoss BRMS
- 5.3.x
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
Issue
When I running BRMS 5.3.x on EAP 6 (with Hibernate 4), I get this message sometimes:
unique constraint (schema.SYS_*****) violated.
Looking into SYS_*****, it is TASK.WORKITEMID column filled up with negative numbers.
Resolution
There is a related bugzilla SessionInfo table doesn't get the MySQL AUTO_INCREMENT flag on EAP6.
The resolution is to set hibernate.id.new_generator_mappings property to false in the configuration file below:
jboss-eap-6.0/standalone/deployments/jbpm-human-task.war/WEB-INF/classes/META-INF/persistence.xml
We recommend to use latest JBoss BRMS 5.3.1 Deployable for EAP 6
installer to install BRMS 5.3.1 on EAP 6, and this property is already added in out-of-box installation to workaround this issue:
<!-- BZ 841786: AS7/EAP 6/Hib 4 uses new (sequence) generators which seem to cause problems -->
<property name="hibernate.id.new_generator_mappings" value="false" />
Root Cause
Root cause of this issue is explained in this Bugzilla: SessionInfo table doesn't get the MySQL AUTO_INCREMENT flag on EAP6
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
