Richard Zowalla created OPENJPA-3025:
----------------------------------------

             Summary: orphan-removal in an XML mapping is lost when the 
relation also cascades remove
                 Key: OPENJPA-3025
                 URL: https://issues.apache.org/jira/browse/OPENJPA-3025
             Project: OpenJPA
          Issue Type: Bug
            Reporter: Richard Zowalla
            Assignee: Richard Zowalla


With an XML mapping, an element removed from a collection mapped with 
{{orphan-removal="true"}} and a cascade that includes remove 
({{<cascade-remove/>}} or {{<cascade-all/>}}) is not deleted. Same bug as 
OPENJPA-3024 for annotations, but older.

Cause: {{XMLPersistenceMetaDataParser}} applies {{orphan-removal}} when the 
element starts ({{setOrphanRemoval()}} sets {{CASCADE_AUTO}}) and the cascades 
in {{finishField()}}, so {{setCascades()}} replaces it with 
{{CASCADE_IMMEDIATE}}.

Fix: apply orphan removal after the cascades, as OPENJPA-3024 does for the 
annotation parser.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to