OpenJPA
  1. OpenJPA
  2. OPENJPA-925

Bidirectional OneToOne relation incorrectly set in loadEagerJoin

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.0, 1.2.1, 1.3.0, 2.0.0-M1, 2.0.0-M2
    • Fix Version/s: 1.2.1, 1.3.0, 2.0.0-M2
    • Component/s: None
    • Labels:
      None

      Description

      A test scenario uncovers a bug in eager loading bidirectional OneToOne relation.

      OneOneParent has a bidirectional OneToOne relation with OneOneChild as annotated as following:

      @Entity
      public class OneOneParent {
      ...
      @OneToOne(mappedBy="parent")
      private OneOneChild child;
      }

      @Entity
      public class OneOneChild {
      ...
      @OneToOne
      private OneOneParent parent;
      }

      Testcase:

      String query = "select c FROM OneOneChild c";
      Query q = em.createQuery(query);
      List list = q.getResultList();

      for (int i = 0; i < list.size(); i++)

      { OneOneChild c = (OneOneChild) list.get(i); assertEquals(c, c.getParent().getChild()); }

      We expect c equals c.getParent().getChild(), but instead got assertion failure.

      It seems to be a bug introduced in performance improvement work (the related issues: OPENJPA-292 & OPENJPA-744).

      1. OPENJPA-925-branches12x.patch
        10 kB
        Donald Woods
      2. OPENJPA-925-branches12x.patch
        10 kB
        Donald Woods

        Issue Links

          Activity

          Catalina Wei created issue -
          Donald Woods made changes -
          Field Original Value New Value
          Attachment OPENJPA-925-branches12x.patch [ 12400425 ]
          Donald Woods made changes -
          Fix Version/s 1.2.1 [ 12313328 ]
          Fix Version/s 1.3.0 [ 12313326 ]
          Fix Version/s 2.0.0 [ 12313483 ]
          Donald Woods made changes -
          Attachment OPENJPA-925-branches12x.patch [ 12400448 ]
          Catalina Wei made changes -
          Resolution Fixed [ 1 ]
          Fix Version/s 1.2.1 [ 12313328 ]
          Status Open [ 1 ] Resolved [ 5 ]
          Donald Woods made changes -
          Status Resolved [ 5 ] Reopened [ 4 ]
          Resolution Fixed [ 1 ]
          Donald Woods made changes -
          Assignee Catalina Wei [ fancy ] Michael Dick [ mikedd ]
          Donald Woods made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Fix Version/s 1.2.1 [ 12313328 ]
          Donald Woods made changes -
          Link This issue is related to OPENJPA-912 [ OPENJPA-912 ]
          Donald Woods made changes -
          Link This issue duplicates OPENJPA-919 [ OPENJPA-919 ]
          Donald Woods made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Michael Dick
              Reporter:
              Catalina Wei
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development