Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330580 - Support class-level cycles for CascadeRemove
Summary: Support class-level cycles for CascadeRemove
Status: CLOSED DUPLICATE of bug 328040
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-18 10:45 EST by Tom Ware CLA
Modified: 2022-06-09 10:03 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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