Hello support,
I have seen multiple attempts to correct similar errors as in the title above - the latest in the 2.2.8.01 release of objectDb.
However I still get this error.
Here is my scenario (Groovy 1.8 and Eclipse 3.6) used.
I have a com.epimss.lab.data.toxicology.TherapeauticDrugScreenRqst. Nested in this class are the following two classes: com.epimss.lab.data.misc.OtherRqst and com.epimss.lab.data.misc.RequestDateAndNumber.
In my Eclipse wizard performFinish() method I persist the TherapeauticDrugScreenRqst data to ObjectDB. For my first attempt at persistence, everything is persisted as expected - I used ObjectDB explorer to view my data.
Now, any other attempt to persist another instance of TherapeauticDrugScreenRqst, with or without restarting my eclipse product results in the following stacktrace:
[ObjectDB 2.2.8_01] javax.jdo.JDOUserException Attempt to persist a reference to a non managed com.epimss.lab.data.misc.OtherRqst instance (error 637) at com.objectdb.jpa.EMImpl.commit(EMImpl.java:277) at javax.jdo.Transaction$commit.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112) at com.epimss.lab.db.Connection.store(Connection.groovy:261) at com.epimss.lab.ui.toxicology.TherapeauticDrugScreenRqstWizard.performFinish(TherapeauticDrugScreenRqstWizard.java:170) at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:811) at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:430) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657) at org.eclipse.jface.window.Window.runEventLoop(Window.java:825) at org.eclipse.jface.window.Window.open(Window.java:801) at com.epimss.lab.handlers.OpenTherapeauticDrugScreenRqstWizardHandler.execute(OpenTherapeauticDrugScreenRqstWizardHandler.java:83) 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.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:47) at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:208) at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:185) at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:101) at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:135) at org.eclipse.e4.ui.workbench.renderers.swt.HandledMenuItemRenderer$1.widgetSelected(HandledMenuItemRenderer.java:150) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:713) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:633) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:106) at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:127) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) 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(EclipseStarter.java:369) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.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:620) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575) at org.eclipse.equinox.launcher.Main.run(Main.java:1408) at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
In an attempt to isoloate the problem I cleaned by project, and enhanced with ObjectDB with the small utility class
public class ObjectDbEnhancer { enhanceLabPlugin() { com.objectdb.Enhancer.enhance( '-s, J:/workspace/epimss/com.epimss.lab/bin-java/com/epimss/lab/data/*.class' ) } void enhanceSharedPlugin() { com.objectdb.Enhancer.enhance( '-s, J:/workspace/epimss/com.epimss.shared/bin-java/com/epimss/shared/data/*.class' ) } public static void main( String[] args ) { def app = new ObjectDbEnhancer() app.enhanceLabPlugin() // app.enhanceSharedPlugin() } // end method main }
Post-enhancement, all files were successfully enhanced.
Here is the contents of the Wizards performFinish method:
@Override public boolean performFinish() { try { therapeauticDrugScreenRqstWizardPage.getM_bindingContext() .updateModels(); therapeauticDrugScreenRqst = therapeauticDrugScreenRqstWizardPage.getTherapeauticDrugScreenRqst(); RequestDateAndNumber requestDateAndNumber = therapeauticDrugScreenRqstWizardPage.getTherapeauticDrugScreenRqstViewForm() .getRequestDateAndNumberViewForm() .getRequestDateAndNumberForm() .getRequestDateAndNumber(); therapeauticDrugScreenRqst.setRequestDateAndNumber( requestDateAndNumber ); OtherRqst otherRqst = therapeauticDrugScreenRqst.getOtherRqst(); otherRqst.setRequestDateAndNumber( therapeauticDrugScreenRqst.getRequestDateAndNumber() ); new Connection( ISharedPreference.DB_OBJECTDB, "admin", "admin" ).store( therapeauticDrugScreenRqst ); } catch( Exception e ) { SiAuto.main.logException( "com.epimss.lab.ui.toxicology.TherapeauticDrugScreenRqstWizard.performFinish()", e ); } // end try-catch return true; } // end method performFinish
Yet, the same stacktrace occurs repeatedly. Why?