| Author |
Mapping issue in hibernate.cfg.xml
|
vivek dhiman
Greenhorn
Joined: Aug 05, 2011
Posts: 26
|
|
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.
|
 |
Reddy Prashanth
Ranch Hand
Joined: Aug 09, 2005
Posts: 61
|
|
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
Greenhorn
Joined: Aug 05, 2011
Posts: 26
|
|
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.
|
 |
 |
|
|
subject: Mapping issue in hibernate.cfg.xml
|
|
|