MountainClimb / datanucleus-appengine

Automatically exported from code.google.com/p/datanucleus-appengine
0 stars 0 forks source link

Unowned list throws exception when both parent and children are detached (JDO) #269

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run attached testUnownedList() method.
2. Note both parent and children exist prior to adding unowned children to the 
parent's list, all 3 are detached.
3. Exception is thrown consistently.

What is the expected output? What do you see instead?
Should be no exception.

What version of the product are you using? On what operating system?
datanucleus-appengine-2.0.0-final-dist.zip, followed v2 upgrade instructions.

Please provide any additional information below.
Detected attempt to establish UnownedTests$Parent(3) as the parent of 
UnownedTests$UnownedChild(1) but the entity identified by 
UnownedTests$UnownedChild(1) has already been persisted without a parent.  A 
parent cannot be established or changed once an object has been persisted.
com.google.appengine.datanucleus.EntityUtils$ChildWithoutParentException: 
Detected attempt to establish UnownedTests$Parent(3) as the parent of 
UnownedTests$UnownedChild(1) but the entity identified by 
UnownedTests$UnownedChild(1) has already been persisted without a parent.  A 
parent cannot be established or changed once an object has been persisted.
    at com.google.appengine.datanucleus.EntityUtils.checkParentage(EntityUtils.java:577)
    at com.google.appengine.datanucleus.scostore.FKListStore.updateElementFk(FKListStore.java:264)
    at com.google.appengine.datanucleus.scostore.FKListStore.internalAdd(FKListStore.java:207)
    at com.google.appengine.datanucleus.scostore.FKListStore.add(FKListStore.java:107)
    at org.datanucleus.store.types.sco.backed.List.add(List.java:634)
    at org.datanucleus.store.types.sco.SCOUtils.updateListWithListElements(SCOUtils.java:896)
    at org.datanucleus.store.types.sco.simple.List.attachCopy(List.java:229)
    at org.datanucleus.store.fieldmanager.AttachFieldManager.storeObjectField(AttachFieldManager.java:204)
    at org.datanucleus.state.AbstractStateManager.providedObjectField(AbstractStateManager.java:1452)
    at com.ysc.service.server.UnownedTests$Parent.jdoProvideField(UnownedTests.java)
    at com.ysc.service.server.UnownedTests$Parent.jdoProvideFields(UnownedTests.java)
    at org.datanucleus.state.AbstractStateManager.provideFields(AbstractStateManager.java:1520)
    at org.datanucleus.state.JDOStateManager.internalAttachCopy(JDOStateManager.java:3303)
    at org.datanucleus.state.JDOStateManager.attachCopy(JDOStateManager.java:3252)
    at org.datanucleus.ObjectManagerImpl.attachObjectCopy(ObjectManagerImpl.java:2372)
    at org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java:1720)
    at org.datanucleus.ObjectManagerImpl.persistObjectWork(ObjectManagerImpl.java:1647)
    at org.datanucleus.ObjectManagerImpl.persistObject(ObjectManagerImpl.java:1512)
    at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:740)
    at org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:765)
    at com.ysc.service.server.UnownedTests.testUnownedList(UnownedTests.java:114)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Original issue reported on code.google.com by vadim.ya...@gmail.com on 21 Feb 2012 at 7:44

Attachments:

GoogleCodeExporter commented 8 years ago
It fails when <property name="datanucleus.CopyOnAttach" value="true"/>, but 
works when <property name="datanucleus.CopyOnAttach" value="false"/>.

Original comment by vadim.ya...@gmail.com on 22 Feb 2012 at 2:37

GoogleCodeExporter commented 8 years ago
jdoconfig.xml is attached.

Original comment by vadim.ya...@gmail.com on 22 Feb 2012 at 2:40

Attachments:

GoogleCodeExporter commented 8 years ago
It appears to work in against the latest trunk.

Original comment by vadim.ya...@gmail.com on 24 Feb 2012 at 8:31

GoogleCodeExporter commented 8 years ago
Since doesn't happen with current code then nothing to do

Original comment by googleco...@yahoo.co.uk on 26 Feb 2012 at 11:41