Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Mapping issue in hibernate.cfg.xml

 
Ranch Hand
Posts: 157
Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi during the execution of simple Java Program Configuration file not able to load the .hbm file. I have done few example in netbeans but in eclipse this encountered. Below is my code under eclipse java project.

Below is my Main Class

My mapping file that is in com package :

My hibernate.cfg.xml that is under src :

I am getting the error :



Please help Don't let me to swich to Netbeans.
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your hibernate.cfg.xml file, below line is not valid.
<mapping class="com.Person.hbm.xml"/>

For class attribute, use class name as below
<mapping class="com.fooPackage.AnotherModelClass" />

Or, use
<mapping resource="com/Person.hbm.xml"/>

Also, if you already mention the mapping file name or class name in the hibernate.cfg.xml, then below line is redundant.
Configuration cfg = new Configuration().addResource("person.hbm.xml").configure();
 
vivek dhiman
Ranch Hand
Posts: 157
Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mr. Reddy. This works now, just made 2 changes.
&


This site is really good & popular just because this reason. Place where i was stuck from last 1 days solved in 1 hr.

thank you again.
 
reply
    Bookmark Topic Watch Topic
  • New Topic