• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

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

 
Ranch Hand
Posts: 1283
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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


















 
Ranch Hand
Posts: 108
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inconsistent package

 
Kaustubh G Sharma
Ranch Hand
Posts: 1283
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 108
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Replace

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


by

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


an example xml configuration
 
Kaustubh G Sharma
Ranch Hand
Posts: 1283
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 108
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 1283
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1283
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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


















 
Ranch Hand
Posts: 473
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My question is, why am I required to declare in the hibernate.cfg.xml

<mapping class="com.ev.hcm.model.Role"/>

where as I am using annotations. Here is my class:



if I declare that mapping class then I get it compiled otherwise I get the same exception, ie, org.hibernate.MappingException: Unknown entity: com.ev.hcm.model.Role

What am I doing wrong?

I am using hibernate3.jar.

Thanks in Advance,

Maki Jav
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!