OpenJPA
  1. OpenJPA
  2. OPENJPA-2132

Traversal of a OneToMany relationship returns an empty list when InheritanceType.JOINED or SINGLE_TABLE is used.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1, 2.1.1, 2.2.0
    • Fix Version/s: 2.1.2, 2.2.1, 2.3.0
    • Component/s: query
    • Labels:
      None

      Description

      I will include a test, named 'OneManyJoinableTest.test' which recreates the issue of this JIRA. Basically though, the test consists of a parent class defined with '@Inheritance(strategy=InheritanceType.JOINED)'. One of the subclasses in the hierarchy contains a (bidirectional) OneToMany relationship. When traversing the ManyToOne side of the relations, all works well. But when traversing the OneToMany side an empty list is returned. When running the test, it can be seen that OpenJPA generate incorrect SQL, as follows:

      SELECT t1.id, t0.id, t2.id, t3.id, t1.name FROM UMLType t0, UMLNamed t1, UMLClass t2, UMLPrimitiveType t3 WHERE t0.OWNERPACKAGE_ID = ? AND t2.id IS NULL AND t3.id IS NULL AND t0.id = t1.id AND t0.id = t2.id AND t0.id = t3.id

      Note that the 't2.id IS NULL AND t3.id IS NULL' seems suspect.

      This same test passes on OpenJPA 1.2.x but fails on OpenJPA 2.0.x on wards.

        Activity

        Heath Thomann created issue -
        Heath Thomann made changes -
        Field Original Value New Value
        Attachment OneManyJoinableTest.test [ 12514546 ]
        Dianne Richards made changes -
        Assignee Heath Thomann [ jpaheath ] Dianne Richards [ dianner ]
        Dianne Richards made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Heath Thomann made changes -
        Fix Version/s 2.1.2 [ 12317142 ]
        Fix Version/s 2.3.0 [ 12319463 ]
        Fix Version/s 2.2.1 [ 12319943 ]
        Albert Lee made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Albert Lee made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        23d 17h 44m 1 Dianne Richards 09/Mar/12 14:33
        In Progress In Progress Resolved Resolved
        214d 3h 44m 1 Albert Lee 09/Oct/12 19:17
        Resolved Resolved Closed Closed
        4s 1 Albert Lee 09/Oct/12 19:17

          People

          • Assignee:
            Dianne Richards
            Reporter:
            Heath Thomann
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development