I am very new to Hibernate and trying to work through several examples.
Hibernate version:3.1
Mapping documents: <hibernate-mapping> <class name="com.hibernate.test.Honey" table="honey"> <meta attribute="session-method"> HibernateUtil.getSession(); </meta> <id name="id" column="honeyId" type="java.lang.Integer"> <!-- postgre: <generate class="sequence"> <param name="sequence">honey_id_seq</param> </generate> --> <generator class="native"/> </id> <property name="name" column="honeyName" type="java.lang.String" /> <property name="taste" column="taste" type="java.lang.String" /> </class> </hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs: org.hibernate.MappingException: Resource: com.hibernate.test.honey.hbm.xml not found at org.hibernate.cfg.Configuration.addResource(Configuration.java:478) at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1443) at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1411) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1392) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1368) at org.hibernate.cfg.Configuration.configure(Configuration.java:1322) at org.hibernate.console.ConsoleConfiguration.loadConfigurationXML(ConsoleConfiguration.java:208) at org.hibernate.console.ConsoleConfiguration.access$0(ConsoleConfiguration.java:155) at org.hibernate.console.ConsoleConfiguration$1.execute(ConsoleConfiguration.java:131) at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35) at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:112) at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:98) at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:19) at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:70) at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:192) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
Name and version of the database you are using:MQSQL
When I change to the Hibernate perspective in Eclipse 3.2, I can see the configuration file for the project. However, when I right click on the configuration file and select "generate Session Factory, I get the above stacktrace. For some reason, the mapping file can not be found. However, the mapping file is in the same directory as the hibernate.cgf.xml file.
What am I doing wrong? Can someone please point me in the right direction?
Thank you in advance for any possible suggestions.
Russ
|