Return-Path: X-Original-To: apmail-openjpa-users-archive@minotaur.apache.org Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2A5412B70 for ; Fri, 29 Apr 2011 19:02:55 +0000 (UTC) Received: (qmail 75945 invoked by uid 500); 29 Apr 2011 19:02:54 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 75911 invoked by uid 500); 29 Apr 2011 19:02:54 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 75903 invoked by uid 99); 29 Apr 2011 19:02:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Apr 2011 19:02:54 +0000 X-ASF-Spam-Status: No, hits=2.0 required=5.0 tests=FREEMAIL_FROM,RFC_ABUSE_POST,SPF_NEUTRAL,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: 216.139.236.26 is neither permitted nor denied by domain of michael.d.dick@gmail.com) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Apr 2011 19:02:49 +0000 Received: from jim.nabble.com ([192.168.236.80]) by sam.nabble.com with esmtp (Exim 4.69) (envelope-from ) id 1QFsxR-0003WQ-4d for users@openjpa.apache.org; Fri, 29 Apr 2011 12:02:29 -0700 Date: Fri, 29 Apr 2011 12:02:29 -0700 (PDT) From: Michael Dick To: users@openjpa.apache.org Message-ID: <1304103749137-6317928.post@n2.nabble.com> In-Reply-To: <1304097313912-6317642.post@n2.nabble.com> References: <1304090274678-6317274.post@n2.nabble.com> <1304097313912-6317642.post@n2.nabble.com> Subject: Re: Same JPQL, different results? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I can help with the different size of the result list. I think you're seeing https://issues.apache.org/jira/browse/OPENJPA-894 OPENJPA-894 . The first time the results of a FETCH JOIN query are read from the database OpenJPA only returns the unique rows. Subsequent FETCH JOIN queries will return duplicates (as defined by the spec). There's also https://issues.apache.org/jira/browse/OPENJPA-1365 OPENJPA-1365 , which complicates things. I think the best workaround for these issues is to make use of OpenJPA's FetchPlans to eagerly load a relationship. Something like this would work : OpenJPAEntityManager em = OpenJPAPersistence.cast(entityManager); FetchPlan plan = em.getFetchPlan(); plan.addField(Node.class, "children"); Query query = em.createQuery("SELECT n from Node n"); I'm not sure whether this will help with your detachment problem though, but it's worth a try. -mike-- View this message in context: http://openjpa.208410.n2.nabble.com/Same-JPQL-different-results-tp6317274p6317928.html Sent from the OpenJPA Users mailing list archive at Nabble.com.