Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 26767 invoked from network); 4 Aug 2009 12:42:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Aug 2009 12:42:31 -0000 Received: (qmail 54844 invoked by uid 500); 4 Aug 2009 12:42:35 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 54795 invoked by uid 500); 4 Aug 2009 12:42:35 -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 54785 invoked by uid 99); 4 Aug 2009 12:42:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Aug 2009 12:42:35 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [91.121.30.210] (HELO 27.mail-out.ovh.net) (91.121.30.210) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 04 Aug 2009 12:42:24 +0000 Received: (qmail 2171 invoked by uid 503); 4 Aug 2009 14:23:51 -0000 Received: from b7.ovh.net (HELO mail405.ha.ovh.net) (213.186.33.57) by 27.mail-out.ovh.net with SMTP; 4 Aug 2009 14:23:51 -0000 Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 4 Aug 2009 12:42:01 -0000 Received: from mol92-3-82-224-241-113.fbx.proxad.net (HELO ?172.16.1.132?) (j-b.briaud%novlog.com@82.224.241.113) by ns0.ovh.net with SMTP; 4 Aug 2009 12:41:58 -0000 Message-Id: From: Jean-Baptiste BRIAUD -- Novlog To: users@openjpa.apache.org In-Reply-To: <4222E0CB-4EEC-483E-99DD-218AA04243CB@novlog.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Subject: Re: Custom proxy : idea review needed Date: Tue, 4 Aug 2009 14:41:57 +0200 References: <9373061D-0AC2-4FB2-B3E4-FF071A2F7434@novlog.com> <1249347995026-3381672.post@n2.nabble.com> <4222E0CB-4EEC-483E-99DD-218AA04243CB@novlog.com> X-Mailer: Apple Mail (2.935.3) X-Ovh-Tracer-Id: 3212755385432924198 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 X-Virus-Checked: Checked by ClamAV on apache.org it is still failling ! After detaching and even closing the entity manager, accessing a not retreived field using fetch plan cause a NPE in pcReplaceField ... I'm completly blocked and in the dark ... I even don't see where investigating more now ... Any idea ? On Aug 4, 2009, at 11:51 , Jean-Baptiste BRIAUD -- Novlog wrote: > > On Aug 4, 2009, at 03:06 , Michael Dick wrote: > >> >> Hi, >> >> Have you tried detaching your entities? When an entity is detached >> OpenJPA >> won't go to the database to load a field. So we'll return null for >> anything >> that isn't in your fetch group (exception : if you load the field >> prior to >> detaching then it will be available). > This is a good point and it had worked, but I'm puzzled : I thought > closing the entityManager will detach managed entities ... and > apparently it is not the case. > If I want to detach entity, I have to detach it explicitly, I didn't > spot that. >> >> You can detach by calling EntityManager.clear() or >> OpenJPAEntityManager.detach(Object o). Either way it'll be a lot >> easier than >> creating your own proxy class. > Sure, it is a *lot* more easier :-) > I'm using detachAll to detach a full collection at once. > I'm not sure about the behavior of clear(), should clear all managed > entity ? > > By the way, this detach behavior will be ammended in version 2.x, I > might try this version, but I feel it could be risky ... On the > other hand, my project's time frame fit well with this version 2. > Any feedback on 2.0 relliability ? > >> >> Hope this helps, > It solve the problem, big big thanks ! >> -mike >> >> >> Jean-Baptiste BRIAUD -- Novlog wrote: >>> >>> Hi, >>> >>> My question is "is there simpler things to do ?" >>> Please, review that idea and don't hesitate to comment ... >>> >>> Step 1 : I want partial object, not hashtables. It could be a Person >>> with only some attributes having values. >>> this concern not only @Basic attribute but also any relational >>> attributes like @ManyToOne, ... >>> => I used fetch plan and it works fine. >>> >>> Step 2 : I'm using an Apache lib via a third party framework that >>> explore all accessors (beanutils). >>> Unfortunatly, unretreived attributes came with a proxy. >>> As a consequence, all unreitreived attributes are now retreived >>> wasting all the benefit of having used fetch plan ... >>> >>> Step 3 : I first try to get rid of that proxies but without success, >>> so I though I could just have my own proxy that could subclass the >>> OpenJPA default proxy >>> and just ensure in my subclass that when I need no proxy, the >>> default >>> behavior is bypassed. >>> >>> What do you think about that idea ? >>> >>> >> >> -- >> View this message in context: http://n2.nabble.com/Custom-proxy-%3A-idea-review-needed-tp3376839p3381672.html >> Sent from the OpenJPA Users mailing list archive at Nabble.com. >> > >