Bug 324341 - support on delete cascade in DDL and runtime
Summary: support on delete cascade in DDL and runtime
Status: RESOLVED FIXED
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: James Sutherland CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks: 312910 325605
  Show dependency tree
 
Reported: 2010-09-02 15:09 EDT by James Sutherland CLA
Modified: 2022-06-09 10:15 EDT (History)
3 users (show)

See Also:


Attachments
patch (337.40 KB, patch)
2010-09-14 11:26 EDT, James Sutherland CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Sutherland CLA 2010-09-02 15:09:09 EDT
There should be a way to specify that delete cascading should be done on the database.  Both for auto DDL generation and to avoid the delete SQL in the runtime.

This was originally logged as a bug on Oracle TopLink #2609603.
Comment 1 James Sutherland CLA 2010-09-14 11:26:12 EDT
Created attachment 178847 [details]
patch
Comment 2 James Sutherland CLA 2010-09-14 11:27:10 EDT
See,

http://wiki.eclipse.org/EclipseLink/DesignDocs/324341
Comment 3 James Sutherland CLA 2010-09-14 11:27:58 EDT
Fixed.

@CascadeOnDelete annotation and processing added.

Still need to add XML support.
Comment 4 James Sutherland CLA 2010-09-14 13:44:21 EDT
SVN trunk(2.2) commit: Bug#324341 cascade delete support

https://bugs.eclipse.org/bugs/show_bug.cgi?id=324341

http://wiki.eclipse.org/EclipseLink/DesignDocs/324341

Code review: Andrei (pending), Guy

Changes:
- Changed Project.getOrderedDescriptors() to return List instead of Vector, updated dbws and moxy references.
- Removed some dead Helper methods and tests.
- Added CascadeOnDelete annotation.
- Added isCascadeOnDeleteSetOnDatabaseOnSecondaryTables to ClassDescriptor.
- Added objectIsEasilyInstantiated to indirection policy.
- Improved logging to log on a flush, and log client session id when acquired.
- Added cascadeOnDelete support to DeleteObject and DeleteAll query mechanism prepare.
- Added cascadeDeleteObjects set to UnitOfWork to track cascade deletion.
- Added delete cascade support to mappings, fixed deletion to not instantiate collection if not required, not execute delete if empty.
- Changed mustDeleteReferenceObjectsOneByOne to an instance variable instead of method, compute in init.
- Changed verifyDelete to also check cascade remove mappings.
- Changed hasDependency to check cascade remove to process delete-all correctly.
- Changed cascade remove to not instantiate the relationship if delete-all can be used when private owned.
- Fixed m-m mapping to still delete if private in a unit of work (was recently broken).
- Fixed Unidirectional 1-m to not cascade delete to map keys if not private owned. 
- Added in memory only option to DeleteAll query to just update the cache.
- Changed DefaultTableGenerator to generate cascade delete in foreign keys if set, added foreign key constraints to direct collection and aggregate collection.
- Added CascadeOnDelete annotation processing to JPA metadata, refactored common relationship processing.
- Added some @Overrides, removed some dead code, change some Vector to generic Lists, some cleanup/micro.

Testing:
- Added cascade delete to JPA DDL test model.
- Added cascade delete to JPA fieldaccess employee test model.
- Added delete tests to fieldaccess entity manager test suite.
Comment 5 Tom Ware CLA 2010-09-16 08:13:56 EDT
*** Bug 325432 has been marked as a duplicate of this bug. ***
Comment 6 James Sutherland CLA 2010-09-22 12:56:09 EDT
fixed
Comment 7 Karen Butzke CLA 2010-12-06 16:23:54 EST
Hey James,
In bug 328937, Guy mentioned that the partitioning policies should not have
been added to the deprecated mapping basic-map and basic-collection in the 2.2 schema. The same should apply for cascade-on-delete.
Comment 8 Eclipse Webmaster CLA 2022-06-09 10:08:06 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 9 Eclipse Webmaster CLA 2022-06-09 10:15:32 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink