Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 11446 invoked from network); 13 May 2007 19:29:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 May 2007 19:29:41 -0000 Received: (qmail 99526 invoked by uid 500); 13 May 2007 19:29:47 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 99493 invoked by uid 500); 13 May 2007 19:29:47 -0000 Mailing-List: contact open-jpa-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: open-jpa-dev@incubator.apache.org Delivered-To: mailing list open-jpa-dev@incubator.apache.org Received: (qmail 99479 invoked by uid 99); 13 May 2007 19:29:47 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 May 2007 12:29:47 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of philippe.alexis@gmail.com designates 209.85.132.246 as permitted sender) Received: from [209.85.132.246] (HELO an-out-0708.google.com) (209.85.132.246) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 May 2007 12:29:40 -0700 Received: by an-out-0708.google.com with SMTP id b33so486582ana for ; Sun, 13 May 2007 12:29:19 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=CW/QDlOJkcUQcV9fajhFOjPSq6+BDb77tVg4ldvOj/XjszEyDaa0b+UtKgsx7n34LDuJcfbGnKVhEvqhuF8aLOenWIbTRrePtVGwriA1I211teFmP68KYbYl+LtGhyBVKcXUaDb8CAhAFDdkQLuP+2RPJEQsaHxtClXZfzuPiIs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=SSdKEWCQDOTO2gh7+dhTUbY+zklD+EEuG6oKasSFLUYBuj9TLmJOyrtdb8tjjAmUpyxOGSOVRf5hPUqMJFvaJy4dkCEi9cMJxlKXX3plmanGYNpw/nhUQIp6U2SFi+BuSaDwx26p0aviR0F+u3aNqpkUxLruojtofI8yeyhoCos= Received: by 10.100.199.12 with SMTP id w12mr3890133anf.1179084558784; Sun, 13 May 2007 12:29:18 -0700 (PDT) Received: by 10.100.173.5 with HTTP; Sun, 13 May 2007 12:29:18 -0700 (PDT) Message-ID: Date: Mon, 14 May 2007 03:29:18 +0800 From: "Philippe Alexis" To: open-jpa-dev@incubator.apache.org Subject: Re: [jira] Commented: (OPENJPA-231) Incorrect handling of cascading bidirectional collections during merge/attach In-Reply-To: <463A5C36.3090806@telenity.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_59139_32878016.1179084558670" References: <22866639.1177981695494.JavaMail.jira@brutus> <27308434.1178136075518.JavaMail.jira@brutus> <463A5C36.3090806@telenity.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_59139_32878016.1179084558670 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Gokhan, I'd been busy with work but kept this particular issue at the back of my mind for coming back to. How far did you get investigating it? Firstly, I had no problem getting updateAttached (EntityManager em) to run fine on both SQL Server and Postgresql, got the count of 4. For updateDetached (EntityManager em), I was able to get it to 'work' by allowing cascading from C to B on the @ManyToOne >From the lack of response to this issue, I'm thinking this might be a design decision the bigger picture of which is eluding me. Anyone would care to shed some light on this, why @ManyToOne(cascade= CascadeType.ALL) solves the problem reported? On MySQL, updateDetached works fine with the modification: @ManyToOne(cascade=CascadeType.ALL) But for updateAttached, the issue of apparently attempting to save instances of C before those of B persists with and without the above change: =================================================== [java] Caused by: <0.9.7-incubating fatal general error> org.apache.openjpa.persistence.PersistenceException: The transaction has been rolled back. See the nested exceptions for details on the errors that occurred. [java] at org.apache.openjpa.kernel.BrokerImpl.newFlushException( BrokerImpl.java:2118) [java] at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java :1965) [java] at org.apache.openjpa.kernel.BrokerImpl.flushSafe( BrokerImpl.java:1863) [java] at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion( BrokerImpl.java:1781) [java] at org.apache.openjpa.kernel.LocalManagedRuntime.commit( LocalManagedRuntime.java:80) [java] at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java :1311) [java] at org.apache.openjpa.kernel.DelegatingBroker.commit( DelegatingBroker.java:866) [java] at org.apache.openjpa.persistence.EntityManagerImpl.commit( EntityManagerImpl.java:409) [java] ... 23 more [java] Caused by: <0.9.7-incubating nonfatal general error> org.apache.openjpa.persistence.PersistenceException: Cannot add or update a child row: a foreign key constraint fails (`test/test_c`, CONSTRAINT `FK_TEST_C_REFERENCE_TEST_B` FOREIGN KEY (`B_ID`) REFERENCES `test_b` (`B_ID`)) {prepstmnt 7832149 INSERT INTO TEST_C (c_id, B_ID) VALUES (?, ?) [params=(int) 4, (int) 4]} [code=1452, state=23000] [java] FailedObject: test.C@1236cd5 [java] at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException( DBDictionary.java:3782) [java] at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore( SQLExceptions.java:97) [java] at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore( SQLExceptions.java:67) [java] at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushInternal( PreparedStatementManagerImpl.java:106) [java] at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flush( PreparedStatementManagerImpl.java:71) [java] at org.apache.openjpa.jdbc.kernel.OperationOrderUpdateManager.flushPrimaryRow( OperationOrderUpdateManager.java:203) [java] at org.apache.openjpa.jdbc.kernel.OperationOrderUpdateManager.flush( OperationOrderUpdateManager.java:89) [java] at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush( AbstractUpdateManager.java:89) [java] at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush( AbstractUpdateManager.java:72) [java] at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush( JDBCStoreManager.java:514) [java] at org.apache.openjpa.kernel.DelegatingStoreManager.flush( DelegatingStoreManager.java:130) [java] ... 30 more [java] Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Cannot add or update a child row: a foreign key constraint fails (`test/test_c`, CONSTRAINT `FK_TEST_C_REFERENCE_TEST_B` FOREIGN KEY (`B_ID`) REFERENCES `test_b` (`B_ID`)) {prepstmnt 7832149 INSERT INTO TEST_C (c_id, B_ID) VALUES (?, ?) [params=(int) 4, (int) 4]} [code=1452, state=23000] [java] at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap( LoggingConnectionDecorator.java:191) [java] at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$800( LoggingConnectionDecorator.java:56) [java] at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeUpdate (LoggingConnectionDecorator.java:857) [java] at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate( DelegatingPreparedStatement.java:269) [java] at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeUpdate (JDBCStoreManager.java:1363) [java] at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushInternal( PreparedStatementManagerImpl.java:95) [java] ... 37 more =================================================== J-Philippe. On 5/4/07, Gokhan Ergul wrote: > > Philippe, > > I must admit I'm quite illiterate when it comes to Eclipse --ditched it > a long time ago in favor of Idea. You must be right about the build.xml > being a not-so-straightforward root for Eclipse import, it didn't occur > to me that it could be used that way. Having said that, here's my > (purely speculative) comments about the problem you're having: > > > [java] javax.persistence.PersistenceException: Invalid or inaccessible > > provider class: org.apache.openjpa.persistence.PersistenceProviderImpl > > [java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute( > > ExecuteJava.java:180) > That sure looks like a classpath problem to me, and the fact that it's > coming from ant..ExecuteJava is somewhat telling, the Eclipse-generated > build.xml is running a task instead of an task, > possibly with a different classpath. > > > Is the use of > > the equivalent of what is done for the examples with > > > > > > ? > > task performs a build-time class enhancement, whereas the > "-javaagent" method performs a run-time enhancement, you can use either > as long as the environment is setup properly. Since the above exception > is coming from a task, I'm assuming you're using run-time > enhancement method, then it boils down to setting the correct classpath > entries. > > If you can post the relevant parts of your build.xml, it'll be easier to > spot the problem. > > Gokhan. > ------=_Part_59139_32878016.1179084558670--