|
|
Re: [teneo] delete help for newbie [message #501062 is a reply to message #500939] |
Mon, 30 November 2009 20:45 |
Allon Moritz Messages: 38 Registered: July 2009 |
Member |
|
|
I have attached the ecore model file as well....I'm quite desperate because from my point of view the model is a very standard one....
here is the code snippet (I figured out that the parent of the productcategory is never set, no clue why, so it will always try to remove the object from the resource)
for (EObject obj : selectedObjects) {
if (obj instanceof ProductCategory) {
ProductCategory p = (ProductCategory) obj;
if (p.getParent() == null)
DBFactory.getProductsResource().getContents().remove(p);
else
p.getParent().getSubCategorys().remove(p);
}
}
and here is the code how I load the resource
ORDERS_RESOURCE = (HibernateResource) resourceSet
.createResource(URI.createURI("hibernate://?"
+ HibernateResource.SESSION_CONTROLLER_PARAM
+ "=ShopDB&query1=FROM Order "));
ORDERS_RESOURCE.load(Collections.EMPTY_MAP);
and here the stack trace
Quote: |
org.hibernate.AssertionFailure: Unable to determine collection owner identifier for orphan-delete processing
at org.hibernate.engine.Collections.processDereferencedCollecti on(Collections.java:101)
at org.hibernate.engine.Collections.processUnreachableCollectio n(Collections.java:62)
at org.hibernate.event.def.AbstractFlushingEventListener.flushC ollections(AbstractFlushingEventListener.java:241)
at org.hibernate.event.def.AbstractFlushingEventListener.flushE verythingToExecutions(AbstractFlushingEventListener.java:100 )
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(De faultFlushEventListener.java:49)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java :366)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransac tion.java:137)
at org.eclipse.emf.teneo.hibernate.HbSessionWrapper.commitTrans action(HbSessionWrapper.java:84)
at com.test.core.DBFactory$ResourceSaver.notifyChanged(DBFactor y.java:142)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:280)
at org.eclipse.emf.common.notify.impl.NotificationImpl.dispatch (NotificationImpl.java:1033)
at org.eclipse.emf.common.notify.impl.DelegatingNotifyingListIm pl.remove(DelegatingNotifyingListImpl.java:709)
at org.eclipse.emf.common.util.DelegatingEList.remove(Delegatin gEList.java:506)
at com.test.ui.actions.DeleteProductCategoryAction.run(DeletePr oductCategoryAction.java:22)
at com.test.ui.actions.EObjectAction.run(EObjectAction.java:81)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:251)
at org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3880)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3473)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 21)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at com.test.ui.Application.start(Application.java:20)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
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: 559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
|
[Updated on: Mon, 30 November 2009 20:47] Report message to a moderator
|
|
|
|
|
|
Re: [teneo] delete help for newbie [message #501229 is a reply to message #501157] |
Tue, 01 December 2009 15:37 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Allon,
I have included your ecore package into a testcase. But before I spend time on building test data. Is it possible for
you to send me the data of your database or the code to create it?
gr. Martin
Allon Moritz wrote:
> here is the code
>
> Properties props = new Properties();
> props.setProperty(Environment.DRIVER,
> "org.apache.derby.jdbc.ClientDriver");
> props.setProperty(Environment.URL,
> "jdbc:derby://localhost:1527/ShopDB;create=true");
> props.setProperty(Environment.DIALECT,
> org.hibernate.dialect.DerbyDialect.class.getName());
> props.setProperty(Environment.SHOW_SQL, "true");
> HbDataStore hbds = (HbDataStore) HbHelper.INSTANCE
> .createRegisterDataStore("ShopDB");
> hbds.setProperties(props);
> hbds.setEPackages(new EPackage[] { ShopPackage.eINSTANCE });
> hbds.initialize();
>
> sessionController = new SessionController();
> sessionController.setHbDataStore(hbds);
> SessionController.registerSessionController("ShopDB",
> sessionController);
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05117 seconds