File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Hibernate Maping error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate Maping error" Watch "Hibernate Maping error" New topic

Hibernate Maping error

trupti nigam
Ranch Hand

Joined: Jun 21, 2001
Posts: 614
I am very new to hibernate and going through some exercise tutorials.
I am following each step in the tutorials and I tried to run my first hibernate app but I get below error.

[java] Initial SessionFactory creation
xception: Could not parse mapping document from resource events/Event.hbm.xml
[java] Exception in thread "main" java.lang.ExceptionInInitializerError
[java] at util.HibernateUtil.<clinit>(Unknown Source)
[java] at events.EventManager.createAndStoreEvent(Unknown Source)
[java] at events.EventManager.main(Unknown Source)
[java] Caused by: org.hibernate.InvalidMappingException: Could not parse ma
pping document from resource events/Event.hbm.xml
[java] at org.hibernate.cfg.Configuration.addResource(Configuration.jav

My directory structure is as follows:

+ src

The event.hbm.xml looks like below:

I am using hsqldb.

EventManager class looks like below:

can someone plese let me know what is wrong with the mapping file.


trupti nigam
Ranch Hand

Joined: Jun 21, 2001
Posts: 614
Any help ranchers..

Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Is Event.hbm.xml in your classpath?

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
trupti nigam
Ranch Hand

Joined: Jun 21, 2001
Posts: 614
Thanks a lot.
The issue is resolved.
You are right, the xml mapping file was not in calsspath due to which I was getting the error message.
I could run the example.

I agree. Here's the link:
subject: Hibernate Maping error
It's not a secret anymore!