-->
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.  [ 7 posts ] 
Author Message
 Post subject: hibernate tools Error:hbm.xml not found
PostPosted: Thu Feb 24, 2005 10:46 pm 
Newbie

Joined: Tue Jan 18, 2005 1:07 am
Posts: 5
Can one answer my question?
My environment is eclipse3.0+Hibernate tools alpha
hibernate.hbm.xml is
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.url">
jdbc:oracle:thin:@x.x.x.x:1521:test
</property>
<property name="hibernate.connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>
<property name="hibernate.connection.username">test</property>
<property name="hibernate.connection.password">test</property>
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.use_outer_join">false</property>
<property name="hibernate.transaction.factory_class">
org.hibernate.transaction.JTATransactionFactory
</property>
<property name="jta.UserTransaction">
java:comp/UserTransaction
</property>
<property name="hibernate.cglib.use_reflection_optimizer">
false
</property>

<mapping resource="Flight.hbm.xml" />


</session-factory>

Flight.hbm.xml is right in the same path with Hibernate.cfg.xml

the above file work correctly in the eclipse's testcase. but when I use hibernate console,it always show the exception

org.hibernate.MappingException: Resource: Flight.hbm.xml not found
at org.hibernate.cfg.Configuration.addResource(Configuration.java:439)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1369)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1341)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1323)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1290)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1252)
at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:151)
at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:128)
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:166)
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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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)

I confuse with this
need your help


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 27, 2005 1:12 pm 
Newbie

Joined: Tue Feb 22, 2005 11:51 am
Posts: 18
Oh, I think, the hibernate.cfg.xml must be in the "root" directory of your project, and the mapping-files must bei in the same directory as the correspondig class, like this:


- myproject
|---de.myproject
|- MyProject.java
|- WhatEver.java
|- MyProcet.hbm.xml
|- WhatEver.hbm.xml
|---hibernate.cfg.xml


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 27, 2005 1:14 pm 
Newbie

Joined: Tue Feb 22, 2005 11:51 am
Posts: 18
ups the editor killed my format

Like this:

The XXX.hbm.xml must be in the same folder(package) as the corresponding class XXX.java. The hibernate.cfg.xml must be in the root directory of your project.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 27, 2005 7:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if you are using resource, the xml file needs to be on the classpath...so go add the root of your xml file to the classpath of the console.

The console dont try to scan your complete project for files - it just do whatever Hibernate would do.

max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 28, 2005 4:46 am 
Newbie

Joined: Tue Jan 18, 2005 1:07 am
Posts: 5
ok it's working. thanks max and seb. you save me time
thinks a lot.


Top
 Profile  
 
 Post subject: Hibernate Eclipse-Need help with hibernate
PostPosted: Tue Dec 20, 2005 1:57 am 
Beginner
Beginner

Joined: Sun Dec 04, 2005 4:28 pm
Posts: 24
FlyInWind wrote:
ok it's working. thanks max and seb. you save me time
thinks a lot.


SO HOW did you to get yours working ???
Just asking because I have the same problem.


Top
 Profile  
 
 Post subject: Hibernate Eclipse-Need help with hibernate
PostPosted: Tue Dec 20, 2005 1:59 am 
Beginner
Beginner

Joined: Sun Dec 04, 2005 4:28 pm
Posts: 24
FlyInWind wrote:
ok it's working. thanks max and seb. you save me time
thinks a lot.


SO HOW did you to get yours working ???
Just asking because I have the same problem.


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