Cayenne
  1. Cayenne
  2. CAY-1714

ROP: Cayenne tries to build a query for non committed object when using more than 2 nested contexts

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1M3
    • Fix Version/s: 3.1B2, 3.2.M1
    • Component/s: ROP
    • Labels:
      None

      Description

      Code describing the problem:

      CayenneContext context = cayenneService.getContext();
      Artist a = context.newObject(Artist.class);
      a.setArtistName("a");

      ObjectContext child = context.createChildContext();
      Painting p = child.newObject(Painting.class);
      p.setPaintingTitle("p");
      p.setToArtist(child.localObject(a));

      child.commitChangesToParent();

      p.getToGallery(); // this will throw an exception

      On the last line following exception will be thrown:

      org.apache.cayenne.CayenneRuntimeException: [v.3.1M4-SNAPSHOT Jun 15 2012 06:55:01] Can't build a query for relationship 'gallery' for temporary id: <ObjectId:Painting, TEMP:000001CA37BA0001>
      at org.apache.cayenne.query.RelationshipQuery.createReplacementQuery(RelationshipQuery.java:113)
      at org.apache.cayenne.query.IndirectQuery.getReplacementQuery(IndirectQuery.java:103)
      at org.apache.cayenne.query.IndirectQuery.route(IndirectQuery.java:86)
      at org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:424)
      ....................

      Persistence state of artist and painting objects by that moment will be COMMITTED.

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Closed Closed
          175d 15h 17m 1 Andrus Adamchik 18/Dec/12 06:51
          Gavin made changes -
          Link This issue is related to CAY-1183 [ CAY-1183 ]
          Gavin made changes -
          Link This issue is related to CAY-1183 [ CAY-1183 ]
          Andrus Adamchik made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Fix Version/s 3.2M1 [ 12321697 ]
          Resolution Fixed [ 1 ]
          Hide
          Andrus Adamchik added a comment -

          Thanks Dima, Ilya for investigating and fixing this issue.

          Show
          Andrus Adamchik added a comment - Thanks Dima, Ilya for investigating and fixing this issue.
          Ilya Drabenia made changes -
          Comment [ Could not reproduce ]
          Andrus Adamchik made changes -
          Fix Version/s 3.1B2 [ 12321877 ]
          Dzmitry Kazimirchyk made changes -
          Link This issue is related too CAY-1183 [ CAY-1183 ]
          Dzmitry Kazimirchyk made changes -
          Field Original Value New Value
          Attachment cay1714-unit-test.patch [ 12533324 ]
          Hide
          Dzmitry Kazimirchyk added a comment -

          Unit test reproducing the issue.

          Show
          Dzmitry Kazimirchyk added a comment - Unit test reproducing the issue.
          Dzmitry Kazimirchyk created issue -

            People

            • Assignee:
              Unassigned
              Reporter:
              Dzmitry Kazimirchyk
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development