Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 14436 invoked from network); 24 Mar 2011 14:28:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Mar 2011 14:28:58 -0000 Received: (qmail 62031 invoked by uid 500); 24 Mar 2011 14:28:58 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 62004 invoked by uid 500); 24 Mar 2011 14:28:58 -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 61975 invoked by uid 99); 24 Mar 2011 14:28:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Mar 2011 14:28:57 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of michael.d.dick@gmail.com designates 209.85.218.46 as permitted sender) Received: from [209.85.218.46] (HELO mail-yi0-f46.google.com) (209.85.218.46) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Mar 2011 14:28:51 +0000 Received: by yia27 with SMTP id 27so4653556yia.33 for ; Thu, 24 Mar 2011 07:28:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=9b0DoujZkSO+n413zYEJ3op6CNm1rmKIkVLyDZ8kbNQ=; b=HIWDNdKNbkTJtecgINqkaj07KmyG1AfSKv5rbA6aPG2VvIg1IKHU5ZI8MIRRIZXXod /iaGDXWZEmprZa81O3k27JmFEfspqgff9IWr+ubJEi3j3DKmL1DcwUggCh13mnN+2MBD S5YvUX6zlbbcsLvi4aMOUO5OTFwSHr3EnshDk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=A7Tl3qrCBC+zJpDxNbRYXWPguj6VleDeTVsFD0yDWt2JWfLg7JAOcgicBh5bW7z9xg DEEl3vVh0GU6YU/MH8cq6Nuc52EAKuqPxwuUvxFOPCdHj94L1fZ1rRQ6dILlMo59mklJ /jDwBCW0S/QbdCGheVKMuEwPQrrRSaLi1bFbM= Received: by 10.91.73.24 with SMTP id a24mr7715890agl.122.1300976910072; Thu, 24 Mar 2011 07:28:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.90.80.1 with HTTP; Thu, 24 Mar 2011 07:28:10 -0700 (PDT) In-Reply-To: References: From: Michael Dick Date: Thu, 24 Mar 2011 09:28:10 -0500 Message-ID: Subject: Re: OpenJPA Date Proxy serialization problem when using entities with GWT To: Prashant Bhat , dev@openjpa.apache.org Content-Type: multipart/alternative; boundary=001485f8942495fa6e049f3b4ac5 X-Virus-Checked: Checked by ClamAV on apache.org --001485f8942495fa6e049f3b4ac5 Content-Type: text/plain; charset=ISO-8859-1 I agree. What I'm aiming to do here is to give the application the option to remove both the StateManager and proxies at a point that makes sense for their application. For a lot of them removing the StateManager and proxies at detach time will make sense. There's no way to do that right now though. To answer Rick's question, the proxies delegate back to the StateManager to dirty a field. If there's no SM they don't do anything, otherwise it's up to the StateManager. -mike On Wed, Mar 23, 2011 at 8:57 PM, Prashant Bhat wrote: > I don't know much about the benefits of using proxies, but in our > particular usage, all proxies should be removed when the entity is > detached/serialized. Then we can use entities directly in GWT avoiding DTOs > and also with this, client side will not have dependency on OpenJPA at > runtime. > > Regards, > Prashant > > > On Wed, Mar 23, 2011 at 9:22 PM, Michael Dick wrote: > >> I haven't had a chance to look at your example application, but I think we >> need to make some changes to the way we handle proxies. >> >> Currently there's no way to prevent proxies from being inserted. It's not >> intuitive when they will be inserted, and they can be tough to remove. >> What >> I'd propose is to make it work something like this : >> >> if openjpa.ProxyManager.TrackChanges == False : >> # No proxies are inserted. Ever. >> >> else : >> >> if openjpa.DetachState.DetachedStateField == "true": >> # proxies are inserted when the entity is flushed (or committed) >> # proxies are not removed when the entity is detached >> # proxies are not removed when the entity is serialized >> >> elif openjpa.DetachState.DetachedStateField == "transient" : >> # proxies are inserted when the entity is flushed (or committed) >> # proxies are not removed when the entity is detached >> # proxies are removed when the entity is serialized >> >> elif openjpa.DetachState.DetachedStateField == "false" : >> # proxies are inserted when the entity is flushed (or committed) >> # proxies are removed when the entity is detached >> # proxies are removed when the entity is serialized >> >> From what I've seen none of these are accurate for trunk, and the related >> code path is a bit tangled (or I just haven't groked it). >> >> For your specific use case, would you want the proxies to ever be >> inserted? >> >> -mike >> >> > --001485f8942495fa6e049f3b4ac5--