You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Matt Watson (JIRA)" <ji...@apache.org> on 2017/03/09 16:21:38 UTC

[jira] [Commented] (CAY-2146) Vertical inheritance: record still inserted into parent db table when child validation fails

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

Matt Watson commented on CAY-2146:
----------------------------------

The reason I feel like checking {{!relationship.isToDependentEntity}} is the proper fix, is because that is the difference between a flattened relationship on a normal object vs a flattened relationship on a vertical inheritance child. When we are using using VI all ObjRelationships start from the Parent DBEntity. So as stated in this tickets description {quote}if a child record has a mandatory relationship{quote} then the first DbJoin in the flattened relationship is the one going from the parent to the child, which by default Cayenne modeler marks as {{isToDependentPK}}.

{{ObjRelationship.isToDependentEntity}} returns true in this case, which means we must let the rest of the validation occur to ensure it has values, else we can "continue" without the validations.

> Vertical inheritance: record still inserted into parent db table when child validation fails
> --------------------------------------------------------------------------------------------
>
>                 Key: CAY-2146
>                 URL: https://issues.apache.org/jira/browse/CAY-2146
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 4.0.M3, 4.0.M6
>            Reporter: Dzmitry Kazimirchyk
>            Assignee: Nikita Timofeev
>             Fix For: Undefined future
>
>         Attachments: vertical_inheritance_missing_child_test.patch
>
>
> When using vertical inheritance, if a child record has a mandatory relationship which is not set, commit will still go through without any errors. However, in database it will create only a record in the parent table without a corresponding child record.
> Attaching patch with a unit test demonstrating the issue.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)