[ 
https://issues.apache.org/jira/browse/OPENJPA-2333?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard Zowalla resolved OPENJPA-2333.
--------------------------------------
    Resolution: Won't Fix

Closing as obsolete during backlog cleanup: The unused root.join("dogs") plus a 
separate get("dogs").get("name") makes two independent joins, so duplicate 
Person rows without distinct are expected; not a defect. Please reopen if this 
still happens with OpenJPA 4.x.

> Problem with duplicated results in criteria
> -------------------------------------------
>
>                 Key: OPENJPA-2333
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2333
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.1
>         Environment: linux or windows
> jdk 6 or 7
> OpenJPA 2.2
>            Reporter: Hebert Coelho
>            Priority: Major
>
> I have described the problem in here: 
> http://openjpa.208410.n2.nabble.com/Problem-with-JPA-Criteria-td7582759.html#a7582764
> The code bellow brings duplicated results when it should only bring one result
>         CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder();
>         CriteriaQuery<Person> criteriaQuery = 
> criteriaBuilder.createQuery(Person.class);
>         Root<Person> mainRoot = criteriaQuery.from(Person.class);
>         criteriaQuery.select(mainRoot);
>         mainRoot.join("dogs", JoinType.INNER);
>         Predicate predicate = 
> criteriaBuilder.and(criteriaBuilder.equal(mainRoot.get("dogs").get("name"), 
> "Fire"));
>         criteriaQuery.where(predicate);
>         TypedQuery<Person> criteriaGeneratedQuery = 
> em.createQuery(criteriaQuery);
>         System.err.println(criteriaGeneratedQuery.getResultList()); // brings 
> two objects instead one
> In the tested database, there is only one dog named Fire.
> If you need more information, just say it.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to