Skip to main content
Jump to: navigation, search

EclipseLink/Development/JPA 2.0/orphan removal

Orphan Removal

JPA 2.0 Root | Enhancement Request

Issue Summary

JPA 2.0 specification has introduced an Orphan Removal option to relationship mappings. If this option is set to true then any child removed from the relationship must be removed (deleted). Adoption (moving a child from one relationship to another and not having it removed) is not supported by the specification but may be an option for EclipseLink.

See JPA 2.0 ED section 2.9 and 9.1.33 for details.

General Solution

This functionality differs from Private Ownership in that removeOrphan does not imply cascade persist as well. Private Ownership treats the relationship as Cascade ALL. If the operation occurred as the first step of the flush operation (queued by change tracking perhaps) then adoption would work automatically.

Work Required

  1. Develop model for testing
    approx 2 days
  2. Update processing
    approx 5 days - functionality
    approx 2 days - annotation/XML updates

Back to the top