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 4FCDDD810 for ; Fri, 24 Aug 2012 09:55:51 +0000 (UTC) Received: (qmail 14908 invoked by uid 500); 24 Aug 2012 09:55:51 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 14642 invoked by uid 500); 24 Aug 2012 09:55:50 -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 14615 invoked by uid 99); 24 Aug 2012 09:55:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Aug 2012 09:55:49 +0000 X-ASF-Spam-Status: No, hits=1.3 required=5.0 tests=SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [31.222.179.249] (HELO rackspace1.logentis.net) (31.222.179.249) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Aug 2012 09:55:43 +0000 Received: from localhost (localhost [127.0.0.1]) by rackspace1.logentis.net (Postfix) with ESMTP id 3BE1D30481 for ; Fri, 24 Aug 2012 11:55:23 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at rackspace1.logentis.net Received: from rackspace1.logentis.net ([127.0.0.1]) by localhost (rackspace1.logentis.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0rwhtjlsbG69 for ; Fri, 24 Aug 2012 11:55:17 +0200 (CEST) Received: from [192.168.170.198] (dynf201.osnanet.de [82.149.162.201]) (Authenticated sender: ml@logemann.org) by rackspace1.logentis.net (Postfix) with ESMTPSA id 2CDFF3031F for ; Fri, 24 Aug 2012 11:55:17 +0200 (CEST) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.0 \(1485\)) Subject: Re: update null relation on merge() From: Marc Logemann In-Reply-To: <88CB62524DE0644AAE21D8BAB8CFC0CA01B03A8F@dueexs06.bertschi.domain> Date: Fri, 24 Aug 2012 11:55:18 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <1414D4DD-AB3F-4CA9-8888-7005261FD0EC@logemann.org> <88CB62524DE0644AAE21D8BAB8CFC0CA01B03A47@dueexs06.bertschi.domain> <6A952FC2-CEED-4945-85B3-EF5D4EC3020E@logemann.org> <88CB62524DE0644AAE21D8BAB8CFC0CA01B03A8F@dueexs06.bertschi.domain> To: users@openjpa.apache.org X-Mailer: Apple Mail (2.1485) i have not configured a detachState somewhere, so i guess its the = default... --- regards Marc Logemann http://www.logemann.org http://www.logentis.de Am 24.08.2012 um 11:50 schrieb Boblitz John : > Which detached state are you using? >=20 >> -----Urspr=FCngliche Nachricht----- >> Von: Marc Logemann [mailto:li@logemann.org]=20 >> Gesendet: Freitag, 24. August 2012 11:43 >> An: users@openjpa.apache.org >> Betreff: Re: update null relation on merge() >>=20 >> 1:1 relations are eager by default.... And eager could be=20 >> only a loading issue. I have a "merge" issue here. >>=20 >> --- >> regards >> Marc Logemann >> http://www.logemann.org >> http://www.logentis.de >>=20 >>=20 >>=20 >>=20 >> Am 24.08.2012 um 11:28 schrieb Boblitz John=20 >> : >>=20 >>> Good Morning, >>>=20 >>> I had this often and one solution is to set the FetchType=20 >> to EAGER for=20 >>> the Relationship. >>>=20 >>> Cheers, >>>=20 >>> John >>>=20 >>>> -----Urspr=FCngliche Nachricht----- >>>> Von: Marc Logemann [mailto:ml@logemann.org] >>>> Gesendet: Freitag, 24. August 2012 11:17 >>>> An: users@openjpa.apache.org >>>> Betreff: update null relation on merge() >>>>=20 >>>> Hi, >>>>=20 >>>> i am facing something like described here: >>>>=20 >>>> http://openjpa.208410.n2.nabble.com/null-values-not-updating-t >>>> d3224059.html >>>>=20 >>>> We get a JSON graph from frontend, let Spring deserialize it to a=20= >>>> java object (with OID set) and want to change the existing=20 >> object in=20 >>>> the db. This works for simple attribtues likes Strings and=20 >> so but not=20 >>>> for 1:1 relations. If we set it to "null" in the frontend,=20 >> we want to=20 >>>> change the 1:1 relation to null. Instead it leaves the 1:1=20 >> relations=20 >>>> untouched with the old object reference in it. >>>>=20 >>>> The OpenJPA docs once said: "When attaching null fields in these=20 >>>> cases, OpenJPA cannot distinguish between a field that was=20 >> unloaded=20 >>>> and one that was intentionally set to null. In this case, OpenJPA=20= >>>> will use the current detach state setting to determine how=20 >> to handle=20 >>>> null fields: fields that would have been included in the detached=20= >>>> state are treated as loaded, and will in turn set the=20 >> corresponding=20 >>>> attached field to null." >>>>=20 >>>> At this point i dont know what to do. Spring knows its detached=20 >>>> because we submit our @Id Field =3D> OID with a valid and existant=20= >>>> value but the merge itself just ignores null values for=20 >> 1:1 relations=20 >>>> and leaves them as they were. Is there any sensible way to tell=20 >>>> OpenJPA to merge "null" >>>> relations differently? >>>>=20 >>>> --- >>>> regards >>>> Marc Logemann >>>> http://www.logemann.org >>>> http://www.logentis.de >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>=20