From dev-return-14955-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Fri Feb 05 08:48:50 2010 Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 16427 invoked from network); 5 Feb 2010 08:48:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Feb 2010 08:48:50 -0000 Received: (qmail 75928 invoked by uid 500); 5 Feb 2010 08:48:50 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 75838 invoked by uid 500); 5 Feb 2010 08:48:49 -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 75827 invoked by uid 99); 5 Feb 2010 08:48:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Feb 2010 08:48:49 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Feb 2010 08:48:48 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id DBD31234C495 for ; Fri, 5 Feb 2010 00:48:27 -0800 (PST) Message-ID: <1801789946.64221265359707885.JavaMail.jira@brutus.apache.org> Date: Fri, 5 Feb 2010 08:48:27 +0000 (UTC) From: "Nik Maximov (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Created: (OPENJPA-1497) org.apache.openjpa.persistence.PersistenceException is thrown while merging detached entity back to the persistence context. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 org.apache.openjpa.persistence.PersistenceException is thrown while merging detached entity back to the persistence context. ---------------------------------------------------------------------------------------------------------------------------- Key: OPENJPA-1497 URL: https://issues.apache.org/jira/browse/OPENJPA-1497 Project: OpenJPA Issue Type: Bug Components: kernel Affects Versions: 1.2.1 Environment: WinXP, JDK 1.6.0_17, H2/Postgres Reporter: Nik Maximov 1. Create an entity which has a one-to-many relationship with other entity (MyEntity ---> MyOtherEntity) 2. Persist the entity. 3. Query the earlier created entity using JPQL. 4. Detach the entyty using OpenJPAEntityManager.detach() method. 5. Query for some entities which the created entity has a one-to-many relashionship (MyOtherEntity) and update the entity with the result of the query, i.e. myEntity.setMyOtherEntities(query.getResultList()); 6. Try to attach the entity back to the persistence context using EntityManager.merge() method. ACT: You will end up with the PersistenceException: org.apache.openjpa.persistence.PersistenceException: Unable to instantiate proxy for type "org.apache.openjpa.kernel.DelegatingResultList". Make sure the class has a default constructor. at org.apache.openjpa.util.ProxyManagerImpl.instantiateProxy(ProxyManagerImpl.java:500) at org.apache.openjpa.util.ProxyManagerImpl.getFactoryProxyCollection(ProxyManagerImpl.java:365) at org.apache.openjpa.util.ProxyManagerImpl.copyCollection(ProxyManagerImpl.java:182) at org.apache.openjpa.kernel.AttachStrategy.copyCollection(AttachStrategy.java:344) at org.apache.openjpa.kernel.AttachStrategy.attachCollection(AttachStrategy.java:321) at org.apache.openjpa.kernel.AttachStrategy.replaceList(AttachStrategy.java:359) at org.apache.openjpa.kernel.AttachStrategy.attachField(AttachStrategy.java:223) at org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy.java:161) at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:241) at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:101) at org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3212) at org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:1158) at org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl.java:769) at test.MyEntityPersitenceTest.testAttach(MyEntityPersitenceTest.java:114) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127) at org.apache.maven.surefire.Surefire.run(Surefire.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.