openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nik Maximov (JIRA)" <j...@apache.org>
Subject [jira] Created: (OPENJPA-1497) org.apache.openjpa.persistence.PersistenceException is thrown while merging detached entity back to the persistence context.
Date Fri, 05 Feb 2010 08:48:27 GMT
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:

<openjpa-1.2.1-r752877:753278 fatal general error> 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.


Mime
View raw message