Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] single join table for mtm results in exception
[Teneo] single join table for mtm results in exception [message #79743] Thu, 12 April 2007 20:03 Go to next message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
Martin,

I updated my model so all many-to-many relationships include the
annotation for setting indexed=false. The resulting database tables look
great. I loaded my data and saved into the database with no problem.

However, when I try to access objects via these single join tables I get
Hibernate exceptions that state the indexed column is NULL, etc.

The mapping file for one of these looks like...

<bag name="contacts" lazy="true"
cascade="merge,persist,save-update,lock,refresh" table="`service_contact`">
<key update="true">
<column name="`service_e_id`" not-null="true" unique="false"/>
</key>
<many-to-many entity-name="Contact" unique="false">
<column name="`contact_e_id`" not-null="true" unique="false"/>
</many-to-many>
</bag>


and ....


<bag name="services" lazy="true"
cascade="merge,persist,save-update,lock,refresh" inverse="true"
table="`service_contact`">
<key update="true">
<column name="`contact_e_id`" not-null="true" unique="false"/>
</key>
<many-to-many entity-name="Service" unique="false">
<column name="`service_e_id`" not-null="true" unique="false"/>
</many-to-many>
</bag>


Any ideas...?

Thanks,
Mark.
Re: [Teneo] single join table for mtm results in exception [message #79758 is a reply to message #79743] Thu, 12 April 2007 20:50 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Mark,
The mapping looks fine, can you post the stack trace?
The exception is thrown for a specific many-to-many probably, can you check which one it is and
check the mapping for that specific many-to-many?

gr. Martin

Mark wrote:
> Martin,
>
> I updated my model so all many-to-many relationships include the
> annotation for setting indexed=false. The resulting database tables look
> great. I loaded my data and saved into the database with no problem.
>
> However, when I try to access objects via these single join tables I get
> Hibernate exceptions that state the indexed column is NULL, etc.
>
> The mapping file for one of these looks like...
>
> <bag name="contacts" lazy="true"
> cascade="merge,persist,save-update,lock,refresh" table="`service_contact`">
> <key update="true">
> <column name="`service_e_id`" not-null="true"
> unique="false"/>
> </key>
> <many-to-many entity-name="Contact" unique="false">
> <column name="`contact_e_id`" not-null="true"
> unique="false"/>
> </many-to-many>
> </bag>
>
>
> and ....
>
>
> <bag name="services" lazy="true"
> cascade="merge,persist,save-update,lock,refresh" inverse="true"
> table="`service_contact`">
> <key update="true">
> <column name="`contact_e_id`" not-null="true"
> unique="false"/>
> </key>
> <many-to-many entity-name="Service" unique="false">
> <column name="`service_e_id`" not-null="true"
> unique="false"/>
> </many-to-many>
> </bag>
>
>
> Any ideas...?
>
> Thanks,
> Mark.
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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
Re: [Teneo] single join table for mtm results in exception [message #79773 is a reply to message #79758] Thu, 12 April 2007 21:41 Go to previous messageGo to next message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
Martin,

The mapping file for the relationship looks fine. In fact, all the mtm
relationships look the same.

Here is the stack....


org.hibernate.HibernateException: null index column for collection:
Service.namedEquipment
at
org.hibernate.persister.collection.AbstractCollectionPersist er.readIndex(AbstractCollectionPersister.java:710)
at
org.hibernate.collection.PersistentList.readFrom(PersistentL ist.java:379)
at org.hibernate.loader.Loader.readCollectionElement(Loader.jav a:994)
at org.hibernate.loader.Loader.readCollectionElements(Loader.ja va:634)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java: 579)
at org.hibernate.loader.Loader.doQuery(Loader.java:689)
at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1985)
at
org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
at
org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
at
org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
at
org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
at
org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
at
org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
at
org.hibernate.collection.PersistentList.toArray(PersistentLi st.java:123)
at
org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList.doLoad(HibernatePersistableEList.java:133)
at
org.eclipse.emf.teneo.mapping.elist.PersistableEList.load(Pe rsistableEList.java:199)
at
org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:433)
at
org.eclipse.emf.common.util.DelegatingEList.size(DelegatingE List.java:214)
at org.eclipse.emf.common.util.BasicEList.<init>(BasicEList.java:79)
at srd.editor.ServiceEditor.init(ServiceEditor.java:1002)
at
org.eclipse.ui.internal.EditorManager.createSite(EditorManag er.java:842)
at
org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:583)
at
org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:372)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:566)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:29 0)
at
org.eclipse.ui.internal.presentations.PresentablePart.setVis ible(PresentablePart.java:140)
at
org.eclipse.ui.internal.presentations.util.PresentablePartFo lder.select(PresentablePartFolder.java:268)
at
org.eclipse.ui.internal.presentations.util.LeftToRightTabOrd er.select(LeftToRightTabOrder.java:65)
at
org.eclipse.ui.internal.presentations.util.TabbedStackPresen tation.selectPart(TabbedStackPresentation.java:394)
at
org.eclipse.ui.internal.PartStack.refreshPresentationSelecti on(PartStack.java:1144)
at org.eclipse.ui.internal.PartStack.setSelection(PartStack.jav a:1097)
at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:13 11)
at org.eclipse.ui.internal.PartStack.add(PartStack.java:455)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:102 )
at org.eclipse.ui.internal.PartStack.add(PartStack.java:441)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:111 )
at
org.eclipse.ui.internal.EditorSashContainer.addEditor(Editor SashContainer.java:60)
at
org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorA reaHelper.java:217)
at
org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAre aHelper.java:207)
at
org.eclipse.ui.internal.EditorManager.createEditorTab(Editor Manager.java:822)
at
org.eclipse.ui.internal.EditorManager.openEditorFromDescript or(EditorManager.java:721)
at
org.eclipse.ui.internal.EditorManager.openEditor(EditorManag er.java:682)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2593)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2528)
at
org.eclipse.ui.internal.WorkbenchPage.access$10(WorkbenchPag e.java:2520)
at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.ja va:2505)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2500)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2477)
at
srd.view.navigator.tree.NavigatorTreeServiceEditPart.perform Request(NavigatorTreeServiceEditPart.java:349)
at
org.eclipse.gef.tools.SelectEditPartTracker.performOpen(Sele ctEditPartTracker.java:187)
at
org.eclipse.gef.tools.SelectEditPartTracker.handleDoubleClic k(SelectEditPartTracker.java:131)
at
org.eclipse.gef.tools.AbstractTool.mouseDoubleClick(Abstract Tool.java:944)
at
org.eclipse.gef.tools.SelectionTool.mouseDoubleClick(Selecti onTool.java:501)
at org.eclipse.gef.EditDomain.mouseDoubleClick(EditDomain.java: 204)
at
org.eclipse.gef.ui.parts.TreeViewer$EventDispatcher.mouseDou bleClick(TreeViewer.java:67)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:141)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3180)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2856)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1930)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:422)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at srd.rcp.SRDEditor.run(SRDEditor.java:29)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Re: [Teneo] single join table for mtm results in exception [message #79806 is a reply to message #79758] Thu, 12 April 2007 22:16 Go to previous message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
Martin,

Don't spend any time on this. It looks like I had an old copy of the
hibernate.hbm.xml file, which is the one used, that caused the schema
change.

I am re-creating and re-loading the data to verify.

Assuming that I am correct sorry for the wild goose chase....

Mark.
Re: [Teneo] single join table for mtm results in exception [message #604718 is a reply to message #79743] Thu, 12 April 2007 20:50 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Mark,
The mapping looks fine, can you post the stack trace?
The exception is thrown for a specific many-to-many probably, can you check which one it is and
check the mapping for that specific many-to-many?

gr. Martin

Mark wrote:
> Martin,
>
> I updated my model so all many-to-many relationships include the
> annotation for setting indexed=false. The resulting database tables look
> great. I loaded my data and saved into the database with no problem.
>
> However, when I try to access objects via these single join tables I get
> Hibernate exceptions that state the indexed column is NULL, etc.
>
> The mapping file for one of these looks like...
>
> <bag name="contacts" lazy="true"
> cascade="merge,persist,save-update,lock,refresh" table="`service_contact`">
> <key update="true">
> <column name="`service_e_id`" not-null="true"
> unique="false"/>
> </key>
> <many-to-many entity-name="Contact" unique="false">
> <column name="`contact_e_id`" not-null="true"
> unique="false"/>
> </many-to-many>
> </bag>
>
>
> and ....
>
>
> <bag name="services" lazy="true"
> cascade="merge,persist,save-update,lock,refresh" inverse="true"
> table="`service_contact`">
> <key update="true">
> <column name="`contact_e_id`" not-null="true"
> unique="false"/>
> </key>
> <many-to-many entity-name="Service" unique="false">
> <column name="`service_e_id`" not-null="true"
> unique="false"/>
> </many-to-many>
> </bag>
>
>
> Any ideas...?
>
> Thanks,
> Mark.
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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
Re: [Teneo] single join table for mtm results in exception [message #604722 is a reply to message #79758] Thu, 12 April 2007 21:41 Go to previous message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
Martin,

The mapping file for the relationship looks fine. In fact, all the mtm
relationships look the same.

Here is the stack....


org.hibernate.HibernateException: null index column for collection:
Service.namedEquipment
at
org.hibernate.persister.collection.AbstractCollectionPersist er.readIndex(AbstractCollectionPersister.java:710)
at
org.hibernate.collection.PersistentList.readFrom(PersistentL ist.java:379)
at org.hibernate.loader.Loader.readCollectionElement(Loader.jav a:994)
at org.hibernate.loader.Loader.readCollectionElements(Loader.ja va:634)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java: 579)
at org.hibernate.loader.Loader.doQuery(Loader.java:689)
at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1985)
at
org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
at
org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
at
org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
at
org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
at
org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
at
org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
at
org.hibernate.collection.PersistentList.toArray(PersistentLi st.java:123)
at
org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList.doLoad(HibernatePersistableEList.java:133)
at
org.eclipse.emf.teneo.mapping.elist.PersistableEList.load(Pe rsistableEList.java:199)
at
org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eSize(PersistableEList.java:433)
at
org.eclipse.emf.common.util.DelegatingEList.size(DelegatingE List.java:214)
at org.eclipse.emf.common.util.BasicEList.<init>(BasicEList.java:79)
at srd.editor.ServiceEditor.init(ServiceEditor.java:1002)
at
org.eclipse.ui.internal.EditorManager.createSite(EditorManag er.java:842)
at
org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:583)
at
org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:372)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:566)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:29 0)
at
org.eclipse.ui.internal.presentations.PresentablePart.setVis ible(PresentablePart.java:140)
at
org.eclipse.ui.internal.presentations.util.PresentablePartFo lder.select(PresentablePartFolder.java:268)
at
org.eclipse.ui.internal.presentations.util.LeftToRightTabOrd er.select(LeftToRightTabOrder.java:65)
at
org.eclipse.ui.internal.presentations.util.TabbedStackPresen tation.selectPart(TabbedStackPresentation.java:394)
at
org.eclipse.ui.internal.PartStack.refreshPresentationSelecti on(PartStack.java:1144)
at org.eclipse.ui.internal.PartStack.setSelection(PartStack.jav a:1097)
at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:13 11)
at org.eclipse.ui.internal.PartStack.add(PartStack.java:455)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:102 )
at org.eclipse.ui.internal.PartStack.add(PartStack.java:441)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:111 )
at
org.eclipse.ui.internal.EditorSashContainer.addEditor(Editor SashContainer.java:60)
at
org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorA reaHelper.java:217)
at
org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAre aHelper.java:207)
at
org.eclipse.ui.internal.EditorManager.createEditorTab(Editor Manager.java:822)
at
org.eclipse.ui.internal.EditorManager.openEditorFromDescript or(EditorManager.java:721)
at
org.eclipse.ui.internal.EditorManager.openEditor(EditorManag er.java:682)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2593)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2528)
at
org.eclipse.ui.internal.WorkbenchPage.access$10(WorkbenchPag e.java:2520)
at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.ja va:2505)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2500)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2477)
at
srd.view.navigator.tree.NavigatorTreeServiceEditPart.perform Request(NavigatorTreeServiceEditPart.java:349)
at
org.eclipse.gef.tools.SelectEditPartTracker.performOpen(Sele ctEditPartTracker.java:187)
at
org.eclipse.gef.tools.SelectEditPartTracker.handleDoubleClic k(SelectEditPartTracker.java:131)
at
org.eclipse.gef.tools.AbstractTool.mouseDoubleClick(Abstract Tool.java:944)
at
org.eclipse.gef.tools.SelectionTool.mouseDoubleClick(Selecti onTool.java:501)
at org.eclipse.gef.EditDomain.mouseDoubleClick(EditDomain.java: 204)
at
org.eclipse.gef.ui.parts.TreeViewer$EventDispatcher.mouseDou bleClick(TreeViewer.java:67)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:141)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3180)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2856)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1930)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:422)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at srd.rcp.SRDEditor.run(SRDEditor.java:29)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Re: [Teneo] single join table for mtm results in exception [message #604731 is a reply to message #79758] Thu, 12 April 2007 22:16 Go to previous message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
Martin,

Don't spend any time on this. It looks like I had an old copy of the
hibernate.hbm.xml file, which is the one used, that caused the schema
change.

I am re-creating and re-loading the data to verify.

Assuming that I am correct sorry for the wild goose chase....

Mark.
Previous Topic:[teneo] xsd that reference another xsd
Next Topic:[teneo] xsd that reference another xsd
Goto Forum:
  


Current Time: Fri Oct 30 20:36:08 GMT 2020

Powered by FUDForum. Page generated in 0.02078 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top