Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-2256

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

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      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().

      CayenneDataObject.java
      if (dbRels.size() == 1 && relationship.isSourceIndependentFromTargetChange()) {
          continue;
      }
      

      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)

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            ntimofeev Nikita Timofeev
            mattraydub Matt Watson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Issue deployment