openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hebert Coelho (JIRA)" <>
Subject [jira] [Created] (OPENJPA-2333) Problem with duplicated results in criteria
Date Mon, 11 Feb 2013 17:19:15 GMT
Hebert Coelho created OPENJPA-2333:

             Summary: Problem with duplicated results in criteria
                 Key: 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

I have described the problem in here:

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);;
        mainRoot.join("dogs", JoinType.INNER);
        Predicate predicate = criteriaBuilder.and(criteriaBuilder.equal(mainRoot.get("dogs").get("name"),

        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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message