aspose file tools*
The moose likes Object Relational Mapping and the fly likes org.hibernate.MappingException: Unknown entity: com.training.HelloWorld Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "org.hibernate.MappingException: Unknown entity: com.training.HelloWorld" Watch "org.hibernate.MappingException: Unknown entity: com.training.HelloWorld" New topic
Author

org.hibernate.MappingException: Unknown entity: com.training.HelloWorld

Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1270


Hello I tried to run a hibernate 2 example but getting org.hibernate.MappingException: Unknown entity: com.training.HelloWorld ... Please help. Can see my code below



















No Kaustubh No Fun, Know Kaustubh Know Fun..
T Mishra
Ranch Hand

Joined: Apr 04, 2006
Posts: 108

Inconsistent package



Thanks,
Tushar (SCJP 1.5)
Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1270

T Mishra wrote:Inconsistent package



Package is right in my code just forget to made change here. but still having issues with it.
T Mishra
Ranch Hand

Joined: Apr 04, 2006
Posts: 108

Replace
<mapping class="com.training.HelloWorld"/>

by
<mapping resource="path/to/.hbm.xml"/>

an example xml configuration
Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1270

T Mishra wrote:Replace
<mapping class="com.training.HelloWorld"/>

by
<mapping resource="path/to/.hbm.xml"/>

an example xml configuration


Getting
T Mishra
Ranch Hand

Joined: Apr 04, 2006
Posts: 108


Assuming the name of the above file is HelloWorld.hbm.xml.
path/to/.hbm.xml

you have to specify path to the HelloWorld.hbm.xml.
Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1270

the same code was working during tutorial but not on my system. is there any particular configuration required for it?
Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1270

Kaustubh G Sharma wrote:
Hello I tried to run a hibernate 2 example but getting org.hibernate.MappingException: Unknown entity: com.training.HelloWorld ... Please help. Can see my code below


















 
It is sorta covered in the JavaRanch Style Guide.
 
subject: org.hibernate.MappingException: Unknown entity: com.training.HelloWorld