[CDO] Feature Map Commit [message #1715725] |
Wed, 25 November 2015 13:43 |
Robert Schulk Messages: 144 Registered: July 2015 |
Senior Member |
|
|
Hello,
I am working with EMF FeatureMaps and CDO. I create the EMF classes from an ecore model which is derived from an XSD. This works all good if I build up my FeatureMap and -afterwards- commit it to CDO.
The issue occurs when I want to add list elements after the object was committed to CDO.
CDOResource resource = transaction.createResource(CDO_TEST_PATH + "/featureMap");
FT ft = FeatureTestFactory.eINSTANCE.createFT();
resource.getContents().add(ft);
ft.getAtest().add(FeatureTestFactory.eINSTANCE.createA());
transaction.commit();
ft.getAtest().add(FeatureTestFactory.eINSTANCE.createA()); <=============== Exception
transaction.commit();
This is the exception I get:
java.lang.ClassCastException: org.eclipse.emf.cdo.internal.common.revision.CDOFeatureMapEntryImpl cannot be cast to java.lang.String
at org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl$26.doCopyValue(CDOTypeImpl.java:610)
at org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl$26.doCopyValue(CDOTypeImpl.java:1)
at org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.copyValue(CDOTypeImpl.java:1021)
at org.eclipse.emf.cdo.internal.common.revision.CDOListImpl.clone(CDOListImpl.java:68)
at org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl.<init>(CDORevisionImpl.java:58)
at org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl.copy(CDORevisionImpl.java:76)
at org.eclipse.emf.internal.cdo.view.CDOStateMachine$WriteTransition.execute(CDOStateMachine.java:997)
at org.eclipse.emf.internal.cdo.view.CDOStateMachine$AbstractWriteTransition.execute(CDOStateMachine.java:941)
at org.eclipse.emf.internal.cdo.view.CDOStateMachine$WriteTransition.execute(CDOStateMachine.java:990)
at org.eclipse.emf.internal.cdo.view.CDOStateMachine$AbstractWriteTransition.execute(CDOStateMachine.java:1)
at org.eclipse.net4j.util.fsm.FiniteStateMachine.process(FiniteStateMachine.java:173)
at org.eclipse.emf.internal.cdo.view.CDOStateMachine.writeWithoutViewLock(CDOStateMachine.java:354)
at org.eclipse.emf.internal.cdo.view.CDOStateMachine.write(CDOStateMachine.java:340)
at org.eclipse.emf.internal.cdo.view.CDOStoreImpl.writeRevision(CDOStoreImpl.java:762)
at org.eclipse.emf.internal.cdo.view.CDOStoreImpl.add(CDOStoreImpl.java:491)
at org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreFeatureMap.delegateAdd(EStoreEObjectImpl.java:425)
at org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreFeatureMap.delegateAdd(EStoreEObjectImpl.java:431)
at org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreFeatureMap.delegateAdd(EStoreEObjectImpl.java:1)
at org.eclipse.emf.common.util.DelegatingEList.addUnique(DelegatingEList.java:308)
at org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl.doAddUnique(DelegatingNotifyingListImpl.java:317)
at org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl.addUnique(DelegatingNotifyingListImpl.java:301)
at org.eclipse.emf.ecore.util.DelegatingFeatureMap.addUnique(DelegatingFeatureMap.java:1512)
at org.eclipse.emf.ecore.util.DelegatingFeatureMap.addUnique(DelegatingFeatureMap.java:1)
at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:303)
at org.eclipse.emf.ecore.util.DelegatingFeatureMap.doAdd(DelegatingFeatureMap.java:530)
at org.eclipse.emf.ecore.util.DelegatingFeatureMap.add(DelegatingFeatureMap.java:1262)
at org.eclipse.emf.ecore.util.FeatureMapUtil$FeatureEList.add(FeatureMapUtil.java:744)
at de.this.is.me.onlytesting.CdoFeatureMapTest.testFailureMockup3(CdoFeatureMapTest.java:95)
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:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
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:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness$1.run(PlatformUITestHarness.java:47)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4147)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3764)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.runApp(NonUIThreadTestApplication.java:54)
at org.eclipse.pde.internal.junit.runtime.UITestApplication.runApp(UITestApplication.java:47)
at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:48)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
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.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
[Updated on: Wed, 25 November 2015 14:27] Report message to a moderator
|
|
|
Re: [CDO] Feature Map Commit [message #1715748 is a reply to message #1715725] |
Wed, 25 November 2015 16:13 |
|
Hi Robert,
I'm afraid that feature maps are not supported by CDO. Many years back we made several attempts to support them, but it
had a very cross-cutting (bad) impact on the source code to the extent that it was alomst not maintainable anymore. Then
we decided to drop support for feature maps. They're really more an XML-land construct and quite unsuitable for
relational databases.
Sorry, but if you want to continue to use CDO please refactor your model and eliminate the feature maps.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Am 25.11.2015 um 14:43 schrieb Robert Schulk:
> Hello,
>
> I am working with EMF FeatureMaps and CDO. This works all good if I build up my FeatureMap and -afterwards- commit it
> to CDO.
>
> The issue occurs when I want to add list elements after the object was committed to CDO.
>
>
> CDOResource resource = transaction.createResource(CDO_TEST_PATH + "/featureMap");
> FT ft = FeatureTestFactory.eINSTANCE.createFT();
> resource.getContents().add(ft);
> ft.getAtest().add(FeatureTestFactory.eINSTANCE.createA()); transaction.commit();
> ft.getAtest().add(FeatureTestFactory.eINSTANCE.createA()); <=============== Exception
> transaction.commit();
>
>
> This works though if I copy the object and replace it within the CDO Resource:
>
>
> CDOResource resource = transaction.createResource(CDO_TEST_PATH + "/featureMap");
> FT ft = FeatureTestFactory.eINSTANCE.createFT();
> resource.getContents().add(ft);
> ft.getAtest().add(FeatureTestFactory.eINSTANCE.createA()); transaction.commit();
> FT ftCopy = EcoreUtil.copy(ft); resource.getContents().set(resource.getContents().indexOf(ft), ftCopy);
> ftCopy.getAtest().add(FeatureTestFactory.eINSTANCE.createA()); transaction.commit();
>
>
> This is the exception I get:
>
>
> java.lang.ClassCastException: org.eclipse.emf.cdo.internal.common.revision.CDOFeatureMapEntryImpl cannot be cast to
> java.lang.String
> at org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl$26.doCopyValue(CDOTypeImpl.java:610)
> at org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl$26.doCopyValue(CDOTypeImpl.java:1)
> at org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.copyValue(CDOTypeImpl.java:1021)
> at org.eclipse.emf.cdo.internal.common.revision.CDOListImpl.clone(CDOListImpl.java:68)
> at org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl.<init>(CDORevisionImpl.java:58)
> at org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl.copy(CDORevisionImpl.java:76)
> at org.eclipse.emf.internal.cdo.view.CDOStateMachine$WriteTransition.execute(CDOStateMachine.java:997)
> at org.eclipse.emf.internal.cdo.view.CDOStateMachine$AbstractWriteTransition.execute(CDOStateMachine.java:941)
> at org.eclipse.emf.internal.cdo.view.CDOStateMachine$WriteTransition.execute(CDOStateMachine.java:990)
> at org.eclipse.emf.internal.cdo.view.CDOStateMachine$AbstractWriteTransition.execute(CDOStateMachine.java:1)
> at org.eclipse.net4j.util.fsm.FiniteStateMachine.process(FiniteStateMachine.java:173)
> at org.eclipse.emf.internal.cdo.view.CDOStateMachine.writeWithoutViewLock(CDOStateMachine.java:354)
> at org.eclipse.emf.internal.cdo.view.CDOStateMachine.write(CDOStateMachine.java:340)
> at org.eclipse.emf.internal.cdo.view.CDOStoreImpl.writeRevision(CDOStoreImpl.java:762)
> at org.eclipse.emf.internal.cdo.view.CDOStoreImpl.add(CDOStoreImpl.java:491)
> at org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreFeatureMap.delegateAdd(EStoreEObjectImpl.java:425)
> at org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreFeatureMap.delegateAdd(EStoreEObjectImpl.java:431)
> at org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreFeatureMap.delegateAdd(EStoreEObjectImpl.java:1)
> at org.eclipse.emf.common.util.DelegatingEList.addUnique(DelegatingEList.java:308)
> at org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl.doAddUnique(DelegatingNotifyingListImpl.java:317)
> at org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl.addUnique(DelegatingNotifyingListImpl.java:301)
> at org.eclipse.emf.ecore.util.DelegatingFeatureMap.addUnique(DelegatingFeatureMap.java:1512)
> at org.eclipse.emf.ecore.util.DelegatingFeatureMap.addUnique(DelegatingFeatureMap.java:1)
> at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:303)
> at org.eclipse.emf.ecore.util.DelegatingFeatureMap.doAdd(DelegatingFeatureMap.java:530)
> at org.eclipse.emf.ecore.util.DelegatingFeatureMap.add(DelegatingFeatureMap.java:1262)
> at org.eclipse.emf.ecore.util.FeatureMapUtil$FeatureEList.add(FeatureMapUtil.java:744)
> at de.this.is.me.onlytesting.CdoFeatureMapTest.testFailureMockup3(CdoFeatureMapTest.java:95)
> 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:47)
> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
> at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
> 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:459)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
> at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
> at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness$1.run(PlatformUITestHarness.java:47)
> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
> at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
> at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4147)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3764)
> at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
> at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
> at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
> at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
> at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
> at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.runApp(NonUIThreadTestApplication.java:54)
> at org.eclipse.pde.internal.junit.runtime.UITestApplication.runApp(UITestApplication.java:47)
> at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:48)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
> 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.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
Powered by
FUDForum. Page generated in 0.03107 seconds