Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330580

Summary: Support class-level cycles for CascadeRemove
Product: z_Archived Reporter: Tom Ware <tom.ware>
Component: EclipselinkAssignee: Project Inbox <eclipselink.orm-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Tom Ware CLA 2010-11-18 10:45:17 EST
There are some cases where it is impossible to determine a commit order that will allow Cascade Remove to work with just DELETE statements.

A simple example:

A has a 1-1 called rel1 to B with foreign key bfk1 on A
B has a 1-1 called rel2 to A with foreign key afk2 on B

In this case, even if there is no instance-level cycle it is impossible to do a delete with just DELETE statements.  An UPDATE needs to be issued to fix the keys to avoid constraint violdation.

i.e.

if my instance model has a1 holding a b1 in rel1 but rel2 is empty, a1 must be deleted first.

if b1 has a1 in rel2, but rel1 is empty, b1 must be deleted first

To make this work, we need a strategy that will work for the general case.  So that one part of that bidirectional relationship will have an update executed on it to null out the FK prior to the delete.

See bug Bug 315141 - which handles the instance-level cycle issue - that bug will also have to be address with this bug.
Comment 1 Tom Ware CLA 2010-11-19 13:34:55 EST

*** This bug has been marked as a duplicate of bug 328040 ***
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:03:28 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink