• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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

 
Ranch Hand
Posts: 1283
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Inconsistent package

 
Kaustubh G Sharma
Ranch Hand
Posts: 1283
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Everybody! Do the Funky Monkey! Like this tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic