Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 22909 invoked from network); 7 Dec 2009 20:48:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Dec 2009 20:48:52 -0000 Received: (qmail 27389 invoked by uid 500); 7 Dec 2009 20:48:52 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 27250 invoked by uid 500); 7 Dec 2009 20:48:51 -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 27240 invoked by uid 99); 7 Dec 2009 20:48:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Dec 2009 20:48:51 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [213.251.189.42] (HELO 42.mail-out.ovh.net) (213.251.189.42) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 07 Dec 2009 20:48:48 +0000 Received: (qmail 13217 invoked by uid 503); 7 Dec 2009 20:48:34 -0000 Received: from b6.ovh.net (HELO mail423.ha.ovh.net) (213.186.33.56) by 42.mail-out.ovh.net with SMTP; 7 Dec 2009 20:48:34 -0000 Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 7 Dec 2009 20:48:25 -0000 Received: from mol92-3-82-224-241-113.fbx.proxad.net (HELO ?172.16.1.10?) (j-b.briaud%novlog.com@82.224.241.113) by ns0.ovh.net with SMTP; 7 Dec 2009 20:48:24 -0000 From: Jean-Baptiste BRIAUD -- Novlog Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: multipart/alternative; boundary=Apple-Mail-1-591344170 Subject: Re: Fetch plan question Date: Mon, 7 Dec 2009 21:48:21 +0100 In-Reply-To: <12D996978341E849B21C51CC97F4771D01FAA44E@mail3.oams.com> To: users@openjpa.apache.org References: <0759E557-8DE9-40FD-B0AE-32604F130AF2@novlog.com> <12D996978341E849B21C51CC97F4771D01FAA35B@mail3.oams.com> <1B67ECC2-5E99-485A-815F-3C71E9A16A53@novlog.com> <12D996978341E849B21C51CC97F4771D01FAA44E@mail3.oams.com> Message-Id: <34A39AC5-3E73-42D0-A7CD-2C39592801A2@novlog.com> X-Mailer: Apple Mail (2.1077) X-Ovh-Tracer-Id: 7644860369132183590 X-Ovh-Remote: 82.224.241.113 (mol92-3-82-224-241-113.fbx.proxad.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|U 0.5/N --Apple-Mail-1-591344170 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Dec 7, 2009, at 18:57 , Michael Vorburger wrote: > Jean-Baptiste, Hi Michael, >=20 > I realized that in our own in-house "framework to simply to the max = the > use of fetchPlan" (just like yours... and ours?) we must be doing the > same we may share some ideas or some directions ... > , so I refereshed my memories by looking back at that code for you Thanks ! > (written over a year ago) and suddenly remembered that indeed there is = a > little "trick", you have to: >=20 > fp.removeFetchGroup(FetchGroup.NAME_DEFAULT); >=20 It was that, a big big thanks. I'm still wondering why the API do not provide a removeAllGroups and = removeALLFields, so even without knowing the name of any groups or = fields, the fetch plan would be 100% empty. I thought that it was already done by that code : final FetchPlan fetchPlan =3D entityManager.getFetchPlan(); fetchPlan.clearFetchGroups(); fetchPlan.clearFields(); Now, thanks to you, I'm doing the following : final FetchPlan fetchPlan =3D entityManager.getFetchPlan(); fetchPlan.clearFetchGroups(); fetchPlan.clearFields(); fetchPlan.removeFetchGroup(FetchGroup.NAME_DEFAULT); > Because (quote from doc) "any field that is eagerly loaded according = to > the JPA metadata rules into the built-in default fetch group. As its > name implies, the default fetch group is active by default. You may = also > define your own..." >=20 In fact, you right, I read that but I still thought I didn't have = fetchGroup forgetting the default one. > Does this help? If yes, why don't you create a little Defect suggest > that the documentation be slightly slightly improved to take this > crystal clear? Once you know it I guess the phrase above is clear, = but > if you don't, it's probably not clear enough? Exactly that ! > A few lines of example & explanation may have helped you? Yes definitively, I would have notices the extra = fetchPlan.removeFetchGroup(FetchGroup.NAME_DEFAULT); >=20 >=20 >> Magazine mag =3D em.find(Magazine.class, magId); >> Will it work also with a query and not only with the find(id) method = ? >> Something like that : em.createQuery("SELECT blablabla ..."); ?? >=20 > Yes yes of course. Make sure you also read & understand the > = http://openjpa.apache.org/builds/1.2.1/apache-openjpa-1.2.1/docs/manual/ > ref_guide_perfpack_eager.html stuff though. >=20 OK, this was like others recents question a way to confirm what I try to = do is correct. When something goes wrong, I always suspect my own = understanding first. > Ciao. >=20 Thanks a lot, I could spent days without finding that default fetchgroup = thing. --Apple-Mail-1-591344170--