Continuum

cannot delete a project, constraint violation

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.1
  • Fix Version/s: 1.3.2 (Beta)
  • Component/s: Data Management
  • Labels:
    None
  • Environment:
    1-1-beta4
  • Complexity:
    Intermediate
  • Number of attachments :
    0

Description

one group project with 2 member projects;
cannot delete members:

javax.jdo.JDOUserException: One or more instances could not be deleted NestedThrowables: javax.jdo.JDODataStoreException: Delete request failed: DELETE FROM PROJECTDEPENDENCY WHERE PROJECTDEPENDENCY_ID=? NestedThrowables: SQL Exception: DELETE on table 'PROJECTDEPENDENCY' caused a violation of foreign key constraint 'PROJECT_FK2' for key (1219321). The statement has been rolled back.

Activity

Hide
Geert Pante added a comment -

I found there were three foreign key constraints on the PROJECT table
CONSTRAINT PROJECT_FK1 FOREIGN KEY (PARENT_PROJECTDEPENDENCY_ID_OID) REFERENCES PROJECTDEPENDENCY (PROJECTDEPENDENCY_ID);
CONSTRAINT PROJECT_FK2 FOREIGN KEY (PARENT_PROJECTDEPENDENCY_ID_OID) REFERENCES SCMRESULT (SCMRESULT_ID);
CONSTRAINT PROJECT_FK3 FOREIGN KEY (PARENT_PROJECTDEPENDENCY_ID_OID) REFERENCES PROJECTGROUP (ID);

I updated the first constraint to 'ON DELETE SET NULL', and dropped the two others, so now it works.
I have no idea what PROJECT_FK2 and PROJECT_FK3 are supposed to do. I only found in continuum-model JPOX config file:
<class>
<name>Project</name>
<version>1.0.9+</version>
<fields>
[...]
<field jpox.fetch-groups="project-all-details project-dependencies">
<name>parent</name>
<version>1.0.9+</version>
<association jpox.join="false">
<type>ProjectDependency</type>
</association>
</field>

Show
Geert Pante added a comment - I found there were three foreign key constraints on the PROJECT table CONSTRAINT PROJECT_FK1 FOREIGN KEY (PARENT_PROJECTDEPENDENCY_ID_OID) REFERENCES PROJECTDEPENDENCY (PROJECTDEPENDENCY_ID); CONSTRAINT PROJECT_FK2 FOREIGN KEY (PARENT_PROJECTDEPENDENCY_ID_OID) REFERENCES SCMRESULT (SCMRESULT_ID); CONSTRAINT PROJECT_FK3 FOREIGN KEY (PARENT_PROJECTDEPENDENCY_ID_OID) REFERENCES PROJECTGROUP (ID); I updated the first constraint to 'ON DELETE SET NULL', and dropped the two others, so now it works. I have no idea what PROJECT_FK2 and PROJECT_FK3 are supposed to do. I only found in continuum-model JPOX config file: <class> <name>Project</name> <version>1.0.9+</version> <fields> [...] <field jpox.fetch-groups="project-all-details project-dependencies"> <name>parent</name> <version>1.0.9+</version> <association jpox.join="false"> <type>ProjectDependency</type> </association> </field>
Hide
Emmanuel Venisse added a comment -

Already fixed.

Show
Emmanuel Venisse added a comment - Already fixed.

People

Vote (6)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: