You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (Jira)" <ji...@apache.org> on 2022/11/28 08:49:00 UTC
[jira] [Updated] (CAY-2779) "Nullify" delete rules is not processed with n:m and inheritance hierarchy
[ https://issues.apache.org/jira/browse/CAY-2779?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrus Adamchik updated CAY-2779:
---------------------------------
Fix Version/s: 5.0.M1
(was: 4.2)
> "Nullify" delete rules is not processed with n:m and inheritance hierarchy
> --------------------------------------------------------------------------
>
> Key: CAY-2779
> URL: https://issues.apache.org/jira/browse/CAY-2779
> Project: Cayenne
> Issue Type: Bug
> Affects Versions: 4.2.RC1
> Reporter: Andrus Adamchik
> Assignee: Nikita Timofeev
> Priority: Major
> Fix For: 5.0.M1
>
>
> A model the same as the one in CAY-2777:
> {noformat}
> // a table with a many to many to self
> T1: id, type
> T11: child_id, parent_id;
> // Base ObjEntity
> O1:
> - flat rel "parents" mapped as "db:parents.parent"
> // Sub ObjEntity 1
> O1S1:
> - flat rel "children" mapped as "db:children.child"
> // Sub ObjEntity 2
> O1S2:
> {noformat}
> n:m has "Nullify" delete rule on both ends. When deleting a child, the child is not removed from parent's children, because the code gets confused about the inheritance hierarchy. Specifically here inside ObjectContextDeleteAction, "reverseArc" is null, whereas it should be "O1S1.children" :
> {noformat}
> case DeleteRule.NULLIFY:
> ArcProperty reverseArc = property.getComplimentaryReverseArc();
> if (reverseArc == null) {
> // nothing we can do here
> break;
> }
> {noformat}
> Oddly enough, it still generated a correct DB operation, deleting the join table record, because of the hardcoded flattened relationship processing block just a few lines prior the one mentioned above.
> These two things are still incorrect:
> * Parent object still has a child in its collection
> * "nodeRemoved" graph operation is not recorded, so any listener flows that depend on it do not work.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)