Community
Participate
Working Groups
A simple Tree example will fail with deletion. If you have a Tree, Tree left, Tree right, create a Tree with children (n levels) then delete them, the deletion will fail with a constraint error. The reason is we order deletes per class, but not per instance (as we do for inserts). This will work correctly for privately owned I think (or maybe not...), but not for cascade delete, or just for multiple remove() calls for the parent and children. Workaround is to null out the references from parent to child, or using flushing or multiple transactions to control the deletion order. This really needs to be fixed.
Setting to future P1 because this likely will not make 2.2, but should be in the next release after.
*** Bug 330580 has been marked as a duplicate of this bug. ***
*** Bug 331538 has been marked as a duplicate of this bug. ***
*** Bug 333476 has been marked as a duplicate of this bug. ***
Created attachment 188546 [details] fixes deletion ordering
Fixed to track reference to deleted objects from other deleted objects in earlyPreDelete and then unravel cycles during deletion the same as insert, includes updating foreign keys to null if a cycle is detected.
SVN trunck pending commit: Bug#328040 - deletion constraint ordering https://bugs.eclipse.org/bugs/show_bug.cgi?id=328040 Code review: Gord (pending) Changes: - track references from deleted objects to other deleted objects in earlyPreDelete - changed delete to be similar to insert, have pre/post commit states and track shallow deletion - during deletion dependent objects are first deleted, if cycle object is shallow deleted by updating foreign keys to null - added test to delete all employees with cycle to JPA em tests - some cleanup of commit process - avoid executing insert/delete queries in mappings if the object was already processed - split old-commit and new-commit methods for collection mappings - changed CollectionChangeRecord to use List/Map generics - fixed earlyPreDelete mappings to be inherited correctly
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink