Hibernate version:
Hibernate 3.0.3
Mapping documents:
Class1 with table Class1p on package pacotedois
Code:
<hibernate-mapping package="pacotedois">
<class
name="Class1"
table="Class1p"
>
<id
column="idClass1"
name="idClass1"
type="java.lang.Integer"
>
<generator class="increment">
</generator>
</id>
<property
name="attr1"
column="attr1"
type="string"
not-null="true"
>
</property>
</class>
</hibernate-mapping>
Class1 with table Class1 on package pacoteum
Code:
<hibernate-mapping package="pacoteum">
<class
name="Class1"
table="Class1"
>
<id
column="idClass1"
name="idClass1"
type="java.lang.Integer"
>
<generator class="increment">
</generator>
</id>
<property
name="field1"
column="field1"
type="java.lang.Integer"
not-null="true"
>
</property>
</class>
</hibernate-mapping>
Full stack trace of any exception that occurs:
org.eclipse.core.runtime.CoreException[1]: D:\eclipse\runtime-workbench-workspace\MdrTest\genClasses.xml:15: Failed in building configuration when adding D:\eclipse\runtime-workbench-workspace\MdrTest\hbm\persistent\pacoteum\Class1.hbm
at org.hibernate.tool.ant.ConfigurationTask.addFile(ConfigurationTask.java:112)
at org.hibernate.tool.ant.ConfigurationTask.addMappings(ConfigurationTask.java:91)
at org.hibernate.tool.ant.ConfigurationTask.doConfiguration(ConfigurationTask.java:77)
at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:50)
at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:150)
at org.hibernate.tool.ant.Hbm2JavaGeneratorTask.execute(Hbm2JavaGeneratorTask.java:37)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:115)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:635)
at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:412)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.eclipse.ant.core.AntRunner.run(AntRunner.java:350)
at org.jtri.tool.popup.actions.GenHbmClasses.run(GenHbmClasses.java:109)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:276)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:915)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:866)
at org.eclipse.jface.action.ActionContributionItem$7.handleEvent(ActionContributionItem.java:785)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2772)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2431)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1377)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:254)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
at org.eclipse.core.launcher.Main.run(Main.java:704)
at org.eclipse.core.launcher.Main.main(Main.java:688)
Caused by: org.hibernate.MappingException: Could not configure datastore from file: D:\eclipse\runtime-workbench-workspace\MdrTest\hbm\persistent\pacoteum\Class1.hbm
at org.hibernate.cfg.Configuration.addFile(Configuration.java:247)
at org.hibernate.tool.ant.ConfigurationTask.addFile(ConfigurationTask.java:108)
... 42 more
Caused by: org.hibernate.MappingException: duplicate import: Class1
at org.hibernate.cfg.Mappings.addImport(Mappings.java:101)
at org.hibernate.cfg.HbmBinder.bindPersistentClassCommonValues(HbmBinder.java:542)
at org.hibernate.cfg.HbmBinder.bindClass(HbmBinder.java:487)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:233)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:151)
at org.hibernate.cfg.Configuration.add(Configuration.java:360)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:397)
at org.hibernate.cfg.Configuration.addFile(Configuration.java:243)
... 43 more
--- Nested Exception ---
org.hibernate.MappingException: Could not configure datastore from file: D:\eclipse\runtime-workbench-workspace\MdrTest\hbm\persistent\pacoteum\Class1.hbm
at org.hibernate.cfg.Configuration.addFile(Configuration.java:247)
at org.hibernate.tool.ant.ConfigurationTask.addFile(ConfigurationTask.java:108)
at org.hibernate.tool.ant.ConfigurationTask.addMappings(ConfigurationTask.java:91)
at org.hibernate.tool.ant.ConfigurationTask.doConfiguration(ConfigurationTask.java:77)
at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:50)
at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:150)
at org.hibernate.tool.ant.Hbm2JavaGeneratorTask.execute(Hbm2JavaGeneratorTask.java:37)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:115)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:635)
at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:412)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.eclipse.ant.core.AntRunner.run(AntRunner.java:350)
at org.jtri.tool.popup.actions.GenHbmClasses.run(GenHbmClasses.java:109)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:276)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:915)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:866)
at org.eclipse.jface.action.ActionContributionItem$7.handleEvent(ActionContributionItem.java:785)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2772)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2431)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1377)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:254)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
at org.eclipse.core.launcher.Main.run(Main.java:704)
at org.eclipse.core.launcher.Main.main(Main.java:688)
Caused by: org.hibernate.MappingException: duplicate import: Class1
at org.hibernate.cfg.Mappings.addImport(Mappings.java:101)
at org.hibernate.cfg.HbmBinder.bindPersistentClassCommonValues(HbmBinder.java:542)
at org.hibernate.cfg.HbmBinder.bindClass(HbmBinder.java:487)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:233)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:151)
at org.hibernate.cfg.Configuration.add(Configuration.java:360)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:397)
at org.hibernate.cfg.Configuration.addFile(Configuration.java:243)
Comments:
It's today's checked out hbm2java ant task (hibernate 3) from sourcesafe. I had never tried before 2 classes with same name but distinct tables and packages on hibernate, and I don't know if it's a know limitation or a bug, or maybe something that I'm not doing right ;)
But I thought it may be a situtation that may happen in a large system.
Thanks