Community
Participate
Working Groups
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.
Created attachment 178847 [details] patch
See, http://wiki.eclipse.org/EclipseLink/DesignDocs/324341
Fixed. @CascadeOnDelete annotation and processing added. Still need to add XML support.
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.
*** Bug 325432 has been marked as a duplicate of this bug. ***
fixed
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.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink