Bug 1030407

Summary: SqlIntegrityConstraintViolationException when duplicating workspace on IBM DB2 9.7
Product: [JBoss] JBoss BPMS Platform 6 Reporter: Jan Hrcek <jhrcek>
Component: BAMAssignee: Roger Martínez <romartin>
Status: CLOSED CURRENTRELEASE QA Contact: Jan Hrcek <jhrcek>
Severity: high Docs Contact:
Priority: medium    
Version: 6.0.0CC: pzapataf
Target Milestone: ER6   
Target Release: 6.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 16:10:29 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Attachments:
Description Flags
Server log with UNEXPECTED ERROR none

Description Jan Hrcek 2013-11-14 06:31:10 EST
Created attachment 823893 [details]
Server log with UNEXPECTED ERROR

Description of problem:
When you try to duplicate workspace there is an unexpected error and the workspace is not duplicated.

Version-Release number of selected component (if applicable):
BPMS 6.0.0 ER4
IBM DB2 9.7 configured as datasource

How reproducible:
Always

Steps to Reproduce:
1. Login with admin user and navigate to workspace Showcase
2. In administration bar click 'Duplicate workspace'

Actual results:
Unexpected error dialog appears. The exception is com.ibm.db2.jcc.am.SqlIntegrityConstraintViolationException: DB2 SQL Error: SQLCODE=-407, SQLSTATE=23502, SQLERRMC=TBSPACEID=2, TABLEID=14, COLNO=3, DRIVER=4.14.122 

Expected results:
Workspace duplicatin should work.

Additional info:
There might be some error in the DDL file 1-create-db2.sql, as on all the other databases we are testing with the workspace duplication functionality works correctly.

See server log attached for full exception stack trace.
Comment 1 Roger Martínez 2013-11-18 11:45:14 EST
In DB2 the "unique" constraint for a table column seems to be handled different from other dbms. Unique constraint in DB2 implies the "not null" constraint too.

When duplicating a workspace in the dashbuilder webapp, the duplicated entity contains, as a initial value, null for the "url" field, which is mapped to a  database column that had a "unique" constraint. Then a constraint violation exception was threw.

As the "unquie" constraint for "url" field is implemented by Java coding too, I just have removed the unique constraint for the DB2 case.

Commits on master
=================
https://github.com/droolsjbpm/dashboard-builder/commit/1d9a39edb01a55157f6b8e4a86c9b923ee8395ad

Commits on 6.0.x
=================
https://github.com/droolsjbpm/dashboard-builder/commit/1c9461a4ccd8f27fed60779621e7f3614e1acfc2
Comment 2 Jan Hrcek 2014-01-03 08:46:54 EST
Ok, verified with BPMS 6.0.0 ER7