Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 25215 invoked from network); 19 Jul 2007 21:31:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Jul 2007 21:31:57 -0000 Received: (qmail 2442 invoked by uid 500); 19 Jul 2007 21:31:29 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 2407 invoked by uid 500); 19 Jul 2007 21:31:29 -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 2373 invoked by uid 99); 19 Jul 2007 21:31:29 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Jul 2007 14:31:29 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Jul 2007 14:31:26 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8749E7141F1 for ; Thu, 19 Jul 2007 14:31:06 -0700 (PDT) Message-ID: <24044018.1184880666550.JavaMail.jira@brutus> Date: Thu, 19 Jul 2007 14:31:06 -0700 (PDT) From: "Kevin Sutter (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-231) Incorrect handling of cascading bidirectional collections during merge/attach MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12514006 ] Kevin Sutter commented on OPENJPA-231: -------------------------------------- Just curious... If you put the CascadeType.ALL on the ManyToOne annotations, does your merge processing work okay? That should not be required, but I am wondering whether we are dealing with similar problems. Thanks. > Incorrect handling of cascading bidirectional collections during merge/attach > ----------------------------------------------------------------------------- > > Key: OPENJPA-231 > URL: https://issues.apache.org/jira/browse/OPENJPA-231 > Project: OpenJPA > Issue Type: Bug > Components: kernel > Affects Versions: 0.9.7 > Environment: platform-independent > Reporter: Gokhan Ergul > Attachments: jira-test-case.zip > > > As posted on open-jpa-dev mailing list: > ----- > I'm having a problem merging an entity, here's the simplified structure: > Class A { @OneToMany(cascade=CascadeType.ALL, mappedBy="parent") > Set b_set; > ... > } > Class B { > @ManyToOne > A parent; > @OneToMany(cascade=CascadeType.ALL, mappedBy="parent") > Set c_set; > ... > } > Class C { > @ManyToOne > B parent; > ... > } > New instances of A,B,C are persisted correctly. However when I retrieve A, add some entries to A.b_set (with some of the new B entries have attached C's), em.merge(A) fails: > - If A is detached: > org.apache.openjpa.persistence.ArgumentException: Encountered new object "B@..." in persistent field "C.parent" of managed object "C@..." during attach. However, this field does not allow cascade attach. You cannot attach a reference to a new object without cascading. > - If A is not detached: > C instances are inserted before B instances, resulting in a foreign key violation. > Setting openjpa.jdbc.SchemaFactory to 'native(ForeignKeys=true)' does not seem to have an effect. > ---- -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.