Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
New in Hibernate checked for similar problems in the forums but I couldn't find anything.
I am following the example on chapter 2 of documentation up to paragraph 2.2. When I try to run the application I am getting MappingException Error reading resource: Event.hbm.xml
What does this means exactly and how do I fix it;
I have created the database and user on MySQL and checked that the access rights are ok.
Hibernate version: 3.0.5
Mapping documents:The Event.hbm.xml is according to the documentation as well as the java files Event.Java, EventManager.java and HibernateUtil.java
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="Event" table="EVENTS">
<id name="id" column="EVENT_ID">
<generator class="increment"/>
</id>
<property name="date" type="timestamp" column="EVENT_DATE"/>
<property name="title"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Initial SessionFactory creation failed.org.hibernate.MappingException: Error reading resource: Event.hbm.xml
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.nn.Event.HibernateUtil.<clinit>(HibernateUtil.java:30)
at com.nn.Event.EventManager.createAndStoreEvent(EventManager.java:40)
at com.nn.Event.EventManager.main(EventManager.java:26)
Caused by: org.hibernate.MappingException: Error reading resource: Event.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:452)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1263)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1235)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1217)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1184)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1112)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1098)
at com.nn.Event.HibernateUtil.<clinit>(HibernateUtil.java:26)
... 2 more
C
Name and version of the database you are using: MySQL 4.1.12-max
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: