[ 
https://issues.apache.org/jira/browse/CAY-2890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17951923#comment-17951923
 ] 

Jadon Hansell commented on CAY-2890:
------------------------------------

I've attached a some breaking tests (and a couple more that currently pass for 
updating from null and to null) for cayenne 5.0, we were also running into this 
on cayenne 4.2. It happens with both the default db row op sorter and the graph 
based one.

> Vertical Inheritance: Updating 1-Many with FK on Child Table Fails
> ------------------------------------------------------------------
>
>                 Key: CAY-2890
>                 URL: https://issues.apache.org/jira/browse/CAY-2890
>             Project: Cayenne
>          Issue Type: Bug
>    Affects Versions: 4.2.2, 5.0-M2
>            Reporter: Jadon Hansell
>            Priority: Major
>         Attachments: 2890-one-to-many-breaking-test.patch
>
>
> If there is a one-to-many relationship where the foreign key is on the child 
> table in a vertical inheritance scenario, updating the relationship will 
> sometimes delete the row on the child table or try to insert a row with 
> mostly null values into the child table instead of updating it.
> The issue seems to happen when the update to the has-many side of the 
> relationship is processed first in 
> `ArcValuesCreationHandler.processFlattenedPath`. When the update to the 
> belongs-to side of the relationship is processed first it issues an update as 
> normal, then skips the has-many side because the inverse relationship has 
> already been processed.
> As a side note, when I implemented a breaking test for this, on one of the 
> test cases cases the GraphBasedDbRowOpSorter throws an error saying that 
> there is a `Cycle detected in list for keys`.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to