• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Hibernate Maping error

 
Ranch Hand
Posts: 647
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 failed.org.hibernate.InvalidMappingE
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
a:575)

My directory structure is as follows:

hibernateTutorial
+ src
+events
event.java
eventManager.java
event.hbm.xml
+util
HibernateUtil.java
Hibernate.cfg.xml

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.

thanks
Trupti




 
trupti nigam
Ranch Hand
Posts: 647
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any help ranchers..

thanks
Trupti
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is Event.hbm.xml in your classpath?
 
trupti nigam
Ranch Hand
Posts: 647
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

thanks
Trupti
 
To do a great right, do a little wrong - shakepeare. twisted little ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic