You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/03/06 20:12:33 UTC

[jira] [Commented] (CAY-2256) Cannot Save/Insert an Object With null Flattened (complex) toOne Relationship

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

ASF GitHub Bot commented on CAY-2256:
-------------------------------------

GitHub user mattraydub opened a pull request:

    https://github.com/apache/cayenne/pull/175

    CAY-2256 Cannot Save/Insert an Object With null Flattened (complex) t…

    …oOne Relationship

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/swarmbox/cayenne CAY-2256

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cayenne/pull/175.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #175
    
----
commit 007dc276e3ecfa2f5dbee2be7b832decc7e77477
Author: Matt Watson <ma...@swarmbox.biz>
Date:   2017-03-06T20:03:02Z

    CAY-2256 Cannot Save/Insert an Object With null Flattened (complex) toOne Relationship

----


> Cannot Save/Insert an Object With null Flattened (complex) toOne Relationship
> -----------------------------------------------------------------------------
>
>                 Key: CAY-2256
>                 URL: https://issues.apache.org/jira/browse/CAY-2256
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 4.0.M4
>            Reporter: Matt Watson
>              Labels: flattened, null, relationship, toOne
>         Attachments: breaking-test.patch
>
>
> When using a Flattened complex join for a toOne Relationship... if you do not set the relationship the {{validateForSave}} on {{CayenneDataObject}} incorrectly attaches a {{ValidationFailure}} saying that the relationship is required.
> Prior to 4.0.M4 this worked correctly, but the commit fixing CAY-2146 introduced this issue. More directly the line of code holding the IF statement below was updated to check the db.Rels.size().
> {code:title= CayenneDataObject.java|borderStyle=solid}
> if (dbRels.size() == 1 && relationship.isSourceIndependentFromTargetChange()) {
>     continue;
> }
> {code}
> While putting this code back makes the test for this issue pass, it obviously makes the test for CAY-2146 FAIL, so I'm not suggesting to put it back, but just pointing it out in case it helps better understand this issue.
> (see attached breaking-test.patch)



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