[
https://issues.apache.org/jira/browse/OPENJPA-3025?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18131949#comment-18131949
]
ASF subversion and git services commented on OPENJPA-3025:
----------------------------------------------------------
Commit 2bc5dd3ee5025e65f6de1323c2407bdd27567b27 in openjpa's branch
refs/heads/OPENJPA-3025 from Richard Zowalla
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=2bc5dd3ee ]
[OPENJPA-3025] Keep orphan removal in an XML mapping that also cascades remove
The XML parser marked an orphan-removal relation dependent when the
one-to-one or one-to-many element started and applied the cascades when
the field ended, so a cascaded remove replaced the dependent marking and
an element removed from the relation was not deleted. Apply orphan
removal after the cascades, as the annotation parser does.
> 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
> Priority: Major
>
> 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)