-->
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.  [ 14 posts ] 
Author Message
 Post subject: urgent help plsss
PostPosted: Mon Jun 13, 2005 8:23 pm 
Newbie

Joined: Mon Jun 13, 2005 8:16 pm
Posts: 4
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

[b]Hibernate version:[alpha4]

I have the following error when I am trying to CreateSessionFactory from an hibernate Console: (Can u help me Max???)
Could not configure datastore from file: D:\RapSprApp\Rapoarte\src\rapDoc\Cohidaq.hbm.xml

org.hibernate.MappingException: Could not configure datastore from file: D:\RapSprApp\Rapoarte\src\rapDoc\Cohidaq.hbm.xml
at org.hibernate.cfg.Configuration.addFile(Configuration.java:249)
at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:163)
at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:129)
at org.hibernate.eclipse.console.actions.BuildSessionFactoryAction.doRun(BuildSessionFactoryAction.java:50)
at org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction.run(ConsoleConfigurationBasedAction.java:47)
at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:167)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:557)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:507)
at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:421)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2908)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2541)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1612)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1578)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:293)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:228)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:333)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:150)
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:268)
at org.eclipse.core.launcher.Main.basicRun(Main.java:260)
at org.eclipse.core.launcher.Main.run(Main.java:887)
at org.eclipse.core.launcher.Main.main(Main.java:871)
Caused by: org.hibernate.MappingException: duplicate import: rapDoc.Cohidaq
at org.hibernate.cfg.Mappings.addImport(Mappings.java:105)
at org.hibernate.cfg.HbmBinder.bindPersistentClassCommonValues(HbmBinder.java:541)
at org.hibernate.cfg.HbmBinder.bindClass(HbmBinder.java:488)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:234)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:152)
at org.hibernate.cfg.Configuration.add(Configuration.java:362)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:400)
at org.hibernate.cfg.Configuration.addFile(Configuration.java:245)
... 28 more


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 13, 2005 8:32 pm 
Newbie

Joined: Mon Jun 13, 2005 8:16 pm
Posts: 4
Im using hibernatetools3(alpha 4) against a MySQL data base


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 14, 2005 1:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Not enough info for me to say but the error indicates one of the mapping files has a duplicate import.

Caused by: org.hibernate.MappingException: duplicate import:

Maybe this will help you find it.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 14, 2005 3:06 am 
Newbie

Joined: Mon Jun 13, 2005 8:16 pm
Posts: 4
what other information do u need?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 14, 2005 5:19 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
The Mapping xml in question would help.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 14, 2005 5:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
most likely you have listed your mapping file in the cfg.xml AND the mapping file list....not a good idea :)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 14, 2005 7:49 am 
Newbie

Joined: Mon Jun 13, 2005 8:16 pm
Posts: 4
thank you ! Yes indeed the hbm.xml files was in two places!

but I have another problem :(

Problem while executing Create SessionFactory(org.hibernate.MappingException: component class not found: PermissionsId)

org.hibernate.MappingException: component class not found: PermissionsId
at org.hibernate.mapping.Component.getComponentClass(Component.java:101)
at org.hibernate.tuple.PojoComponentTuplizer.buildGetter(PojoComponentTuplizer.java:105)
at org.hibernate.tuple.AbstractComponentTuplizer.<init>(AbstractComponentTuplizer.java:40)
at org.hibernate.tuple.PojoComponentTuplizer.<init>(PojoComponentTuplizer.java:112)
at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:68)
at org.hibernate.mapping.Component.getType(Component.java:156)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:252)
at org.hibernate.mapping.RootClass.validate(RootClass.java:189)
at org.hibernate.cfg.Configuration.validate(Configuration.java:839)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1000)
at org.hibernate.console.ConsoleConfiguration$1.execute(ConsoleConfiguration.java:222)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:77)
at org.hibernate.console.ConsoleConfiguration.initSessionFactory(ConsoleConfiguration.java:220)
at org.hibernate.eclipse.console.actions.BuildSessionFactoryAction.doRun(BuildSessionFactoryAction.java:51)
at org.hibernate.eclipse.console.actions.ConsoleConfigurationBasedAction.run(ConsoleConfigurationBasedAction.java:47)
at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:167)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:557)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:507)
at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:421)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2908)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2541)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1612)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1578)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:293)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:228)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:333)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:150)
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:268)
at org.eclipse.core.launcher.Main.basicRun(Main.java:260)
at org.eclipse.core.launcher.Main.run(Main.java:887)
at org.eclipse.core.launcher.Main.main(Main.java:871)
Caused by: java.lang.ClassNotFoundException: PermissionsId
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:359)
at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.loadClass(AbstractClassLoader.java:94)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
at org.hibernate.mapping.Component.getComponentClass(Component.java:98)
... 38 more


Top
 Profile  
 
 Post subject: org.hibernate.MappingException: duplicate import:
PostPosted: Wed Jan 11, 2006 1:13 pm 
Newbie

Joined: Wed Jan 11, 2006 1:10 pm
Posts: 4
max wrote:
most likely you have listed your mapping file in the cfg.xml AND the mapping file list....not a good idea :)


hi there,

i too am getting the same exception. i have the mapping declared under cfg.xml , where else might the declaration be. i auto generated the mapping xml's so i am unable to figure that out..........

TIA


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 11, 2006 1:24 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what prevents you from *looking* at the generate mapping files ? :)

anyhow, that exception is there because you havent put the build directory on the classpath of the console configuration.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 11, 2006 2:59 pm 
Newbie

Joined: Wed Jan 11, 2006 1:10 pm
Posts: 4
max wrote:
what prevents you from *looking* at the generate mapping files ? :)

anyhow, that exception is there because you havent put the build directory on the classpath of the console configuration.


i've been *looking* for abt 2 hrs , so i thought i wud ask the 'wise men' than to beat myself........... thx for caring though. :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 11, 2006 3:41 pm 
Newbie

Joined: Wed Jan 11, 2006 1:10 pm
Posts: 4
i pieced out the solution........... here's the practice i was unaware of.....

*************************************************
The preferred practice is to place an hbm.xml file for each persistent class in the package with the .java file. If you do this, then you need specify nothing in your hibernate.cfg.xml file to "import" the config. Instead, you simply add the class to your Configuration object before building the SessionFactory:


sessionFactory = new Configuration()
.addClass(Event.class)
.configure()
.buildSessionFactory();



Hibernate will assume you have followed preferred practice.

***************************************************


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 11, 2006 3:45 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what does that practice have to do with how classes are loaded in the eclipse plugin ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 11, 2006 3:57 pm 
Newbie

Joined: Wed Jan 11, 2006 1:10 pm
Posts: 4
i was having the 'mapping resources ' node in the cfg.xml along with having persistent object java files and the hbm.xml's together in the same directory and hence the duplicate import exception........

comment out the mappings in the cfg.xml ........ thats it..........


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 12, 2006 2:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
and you say that happend in the tools ? If you just list the files in cfg.xml everything should be fine...

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 14 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.