Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8A16FE188 for ; Mon, 11 Feb 2013 17:19:15 +0000 (UTC) Received: (qmail 15055 invoked by uid 500); 11 Feb 2013 17:19:15 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 15027 invoked by uid 500); 11 Feb 2013 17:19:15 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 15018 invoked by uid 99); 11 Feb 2013 17:19:15 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Feb 2013 17:19:15 +0000 Date: Mon, 11 Feb 2013 17:19:15 +0000 (UTC) From: "Hebert Coelho (JIRA)" To: dev@openjpa.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (OPENJPA-2333) Problem with duplicated results in criteria MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Hebert Coelho created OPENJPA-2333: -------------------------------------- Summary: 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 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 criteriaQuery = criteriaBuilder.createQuery(Person.class); Root 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 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: http://www.atlassian.com/software/jira