Win a copy of Modern JavaScript for the Impatient 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
Ranch Hand
Posts: 1283
Netbeans IDE Chrome Java
  • 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
Netbeans IDE Chrome Java
  • 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
Netbeans IDE Chrome Java
  • 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
Netbeans IDE Chrome Java
  • 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
Netbeans IDE Chrome Java
  • 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
    Bookmark Topic Watch Topic
  • New Topic