-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Help mapping many-to-many using relationship tables v2
PostPosted: Thu Oct 20, 2005 8:46 am 
Beginner
Beginner

Joined: Thu Aug 04, 2005 2:24 pm
Posts: 45
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3

Mapping documents:

Code between sessionFactory.openSession() and session.close():
Nothing. Just trying to open and close the session...

Full stack trace of any exception that occurs:
Code:
!ENTRY org.eclipse.ui 4 0 2005-10-20 08:30:01.805
!MESSAGE Warning: Detected recursive attempt by part com.genuitec.eclipse.hibernate.editors.HibernateConfigXMLEditor to create itself (this is probably, but not necessarily, a bug)
!STACK 1
org.eclipse.ui.PartInitException: Warning: Detected recursive attempt by part com.genuitec.eclipse.hibernate.editors.HibernateConfigXMLEditor to create itself (this is probably, but not necessarily, a bug)
   at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:543)
   at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:223)
   at org.eclipse.ui.internal.EditorManager.findEditor(EditorManager.java:477)
   at org.eclipse.ui.internal.EditorManager.findEditor(EditorManager.java:402)
   at org.eclipse.ui.internal.EditorManager.findEditor(EditorManager.java:372)
   at org.eclipse.ui.internal.WorkbenchPage.findEditor(WorkbenchPage.java:1780)
   at com.genuitec.eclipse.core.util.EditorUtil.getEditorForInput(Unknown Source)
   at com.genuitec.eclipse.core.util.EditorUtil.checkConflictingEditor(Unknown Source)
   at com.ibm.xmleditor.internal.XMLMultiPageEditorPart.init(XMLMultiPageEditorPart.java:568)
   at org.eclipse.ui.internal.EditorManager.createSite(EditorManager.java:778)
   at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:596)
   at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:384)
   at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:552)
   at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:283)
   at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:126)
   at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:268)
   at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
   at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:391)
   at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1102)
   at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1051)
   at org.eclipse.ui.internal.PartStack.presentationSelectionChanged(PartStack.java:785)
   at org.eclipse.ui.internal.PartStack.access$0(PartStack.java:771)
   at org.eclipse.ui.internal.PartStack$1.selectPart(PartStack.java:119)
   at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation$1.handleEvent(TabbedStackPresentation.java:126)
   at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:267)
   at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:276)
   at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder.access$1(DefaultTabFolder.java:1)
   at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder$2.handleEvent(DefaultTabFolder.java:84)
   at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:867)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:852)
   at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:660)
   at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3138)
   at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1922)
   at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:288)
   at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
   at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080)
   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2713)
   at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
   at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
   at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
   at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
   at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
   at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
   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.core.launcher.Main.invokeFramework(Main.java:334)
   at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
   at org.eclipse.core.launcher.Main.run(Main.java:973)
   at org.eclipse.core.launcher.Main.main(Main.java:948)
!SUBENTRY 1 org.eclipse.ui 4 0 2005-10-20 08:30:01.815
!MESSAGE Warning: Detected recursive attempt by part com.genuitec.eclipse.hibernate.editors.HibernateConfigXMLEditor to create itself (this is probably, but not necessarily, a bug)


Name and version of the database you are using:
Oracle9i

The generated SQL (show_sql=true):
none

Debug level Hibernate log excerpt:


Hello,

I'm trying to convert this one-to-many relationship between 3 tables into a many-to-many relationship, using the third table as the relationship.

So, this is the sql code to my tables:
Code:
create table tbltcomponent (
   component_num number(10,0) not null ,
                ...
)

create table tbltassembly (
   assembly_num number(10,0) not null ,
                ...
)

create table maxfactory.tbltassembly_comp (
   record_num number(10,0) not null ,
   assembly_num number(10,0) not null ,
   component_num number(10,0) not null ,
                ...
)


I only typed the PK's annd Fk's, which are created separately in my sql code...

The POJOs have:
In Abstracttbltassembly
Code:
    /** The value of the tbltCompSet many-to-many association. */
    private java.util.Set tbltCompSet;


In Abstracttbltcomponent
Code:
    /** The value of the tbltAssemblySet many-to-many association. */
    private java.util.Set tbltAssemblySet;


So, the mappings i created in each hibernate mapping file is:

In tbltassembly:
Code:
        <set name="tbltCompSet" table="tbltassembly_comp" cascade="all">
            <key column="ASSEMBLY_NUM"/>
            <many-to-many column="COMPONENT_NUM" class="com.MDSI.MAXIMUMFactory.Tbltcomponent"/>
        </set>


In tbltcomponent:
Code:
        <set name="tbltAssemblySet" table="tbltassembly_comp" inverse="true" cascade="all">
            <key column="COMPONENT_NUM"/>
            <many-to-many column="ASSEMBLY_NUM" class="com.MDSI.MAXIMUMFactory.Tbltassembly"/>
        </set>


From what i've read, this is supposed to be correct, but, obviously, the Exception generated tells me otherwise.

Coul anybody give me a help with that, please?

Thanks a lot you all.

Eduardo

_________________
Eduardo Mylonas


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 9:43 am 
Beginner
Beginner

Joined: Thu Aug 04, 2005 2:24 pm
Posts: 45
A good thing to mention is if the mappings are set as they were first generated, with 3 many-to-may-mappings, this exception is not thrown and i have it working.

Thanks

_________________
Eduardo Mylonas


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 9:56 am 
Beginner
Beginner

Joined: Thu Aug 04, 2005 2:24 pm
Posts: 45
Hello, Folks.

Problem solved. Actually it was a basic mistake. I forgot to adjust the get and set method names to the new property names.

Thanks a lot you all

_________________
Eduardo Mylonas


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.