[
https://issues.apache.org/jira/browse/OPENJPA-3025?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18133730#comment-18133730
]
ASF subversion and git services commented on OPENJPA-3025:
----------------------------------------------------------
Commit 434f89f833ce81f1328c59de2a5fe34334d9ef0b in openjpa's branch
refs/heads/OPENJPA-3039 from Richard Zowalla
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=434f89f83 ]
[OPENJPA-3025] Keep orphan removal in an XML mapping that also cascades remove
(#228)
* [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.
* [OPENJPA-3025] Use try-with-resources in the test
> 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
> Fix For: 4.2.0
>
>
> 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)