Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EEDDB37B8 for ; Fri, 6 May 2011 18:12:40 +0000 (UTC) Received: (qmail 74163 invoked by uid 500); 6 May 2011 18:12:40 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 74146 invoked by uid 500); 6 May 2011 18:12:40 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 74138 invoked by uid 99); 6 May 2011 18:12:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 May 2011 18:12:40 +0000 X-ASF-Spam-Status: No, hits=1.6 required=5.0 tests=RCVD_IN_BRBL_LASTEXT,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [208.28.14.2] (HELO mail.aopslab.com) (208.28.14.2) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 06 May 2011 18:12:34 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.aopslab.com (Postfix) with ESMTP id E010B15205CB for ; Fri, 6 May 2011 14:05:23 -0400 (EDT) X-DSPAM-Result: Innocent X-DSPAM-Class: Innocent X-DSPAM-Confidence: 1.00 X-DSPAM-Probability: 0.0023 X-DSPAM-Signature: N/A X-Virus-Scanned: amavisd-new at X-Spam-Score: -3.91 X-Spam-Level: Received: from mail.aopslab.com ([127.0.0.1]) by localhost (mail.aopslab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VxD8FX4GtSIn for ; Fri, 6 May 2011 14:05:20 -0400 (EDT) Received: from webmail.aopslab.com (webmail.aopslab.com [192.168.10.12]) by mail.aopslab.com (Postfix) with ESMTP id B0B9115205A7 for ; Fri, 6 May 2011 14:05:20 -0400 (EDT) Date: Fri, 06 May 2011 14:05:19 -0400 (EDT) From: Tony Dahbura Reply-To: Tony Dahbura To: user@cayenne.apache.org Subject: Re: Help Again on DataContext Message-ID: <651cc1d6-0b3f-47f3-a3e2-babae1a465b3@webmail.aopslab.com> In-Reply-To: <1304558181970-2901635.post@n3.nabble.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-Originating-IP: [10.2.18.109] X-Mailer: Zimbra 7.0.0_GA_3077 (ZimbraWebClient - FF3.0 (Mac)/7.0.0_GA_3077) X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Flag: NO X-Old-Spam-Status: No, score=-3.91 tagged_above=-10 required=6.6 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01, DSPAM:Innocent=-1.000] autolearn=ham Can you send me a little more of the code snippet please? Is it basically registering the object into a new context or the same one it came from? Thanks, Tony ----- Original Message ----- From: "miguel_de_sousa" To: user@cayenne.apache.org Sent: Wednesday, May 4, 2011 9:16:21 PM Subject: Re: Help Again on DataContext Hi Tony, Sorry if this reply doesn't really help a lot but the way I do something similar to what you're talking about is I serialise the object into xml with XMLEncoder.encode(persistentObject) then when I get the serialised object back I do XMLEncoder.decode(serialisedObjectXml, DataObject). So: String serialisedXml = XMLEncoder.encode(persistentObject); ..... XMLEncoder.decode(serialisedXml, getDataContext()); try{ getDataContext().commitChanges(); } catch(CayenneRuntimeException ex){ getDataContext().rollbackChanges(); } I do this as a seperation of concerns because I use webservices as the point of contact for all clients (webapps/Desktop GUI apps/Mobile apps), but does work very nicely -- it also works with new objects (so I create the XML that would represent the new object without the primary key set and Cayenne works that out on commit). -- View this message in context: http://cayenne.195.n3.nabble.com/Help-Again-on-DataContext-tp2899105p2901635.html Sent from the Cayenne - User mailing list archive at Nabble.com.