Heath Thomann created OPENJPA-2475:
--------------------------------------

             Summary: A query with LEFT FETCH JOIN returns incorrect results.
                 Key: OPENJPA-2475
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2475
             Project: OpenJPA
          Issue Type: Bug
          Components: query
    Affects Versions: 2.2.2, 2.1.1, 2.2.1.1, 2.3.0, 2.4.0
            Reporter: Heath Thomann
            Assignee: Heath Thomann
            Priority: Minor


Take the following two entities:

@Entity
public class DepartmentTest{    
    @Id
    private String primaryKey;

    @OrderBy("name")
    @OneToMany(mappedBy = "departmentTest")
     private Set<PersonTest> persons = new HashSet<PersonTest>();
...........

@Entity
public class PersonTest  {
        @Id
        private String primaryKey;

        @ManyToOne
        @ForeignKey
        private DepartmentTest departmentTest;

        private String name;
.....

With these entities, take this JPQL:

"SELECT DISTINCT dept FROM DepartmentTest dept LEFT JOIN FETCH dept.persons";

Depending on the data in the database (the order is important, see the provided 
test), this query can return a results set where some of the 'persons' are 
missing.

Thanks,

Heath Thomann



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to