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

org.hibernate.MappingException: Unknown entity

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using spring 3, Hibernate 3.6 and I have the following Exception which occurs when addEntity(...) is exuted






Spring Context XML :



The DAO




The Entity class

 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you try with JPA-QL instead of sql?

Or when you call addEntity. Try putting the full package/classname as the String. "org.stockdomain.domain.Stock"


I never use SQL with addEntity, I would always use JPA-QL myself, but that doesn't mean that what you did was wrong.

so JPA-QL would be

String ql = "Select * from Stock"
return sessionFactory.getCurrentSession().createQuery(ql).list();

I suggest trying with JPA-QL to see what the real problem could be. Is it the String "Stock" or something more than just that.

Mark
 
Frank VanOor
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi mark,

After trying so many options/solutions, finally the reason was found : A jar was missing -->javassist.jar
I noticed that it's defined as a dependency in the pom of hibernate, but eclipse/maven (m2) didn't download !!!

thanks a lot,

Frank
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Frank VanOor wrote:Hi mark,

After trying so many options/solutions, finally the reason was found : A jar was missing -->javassist.jar
I noticed that it's defined as a dependency in the pom of hibernate, but eclipse/maven (m2) didn't download !!!

thanks a lot,

Frank



Sweet. Lots of fun when the actual problem is not what shows.

Mark
 
Being a smart alec beats the alternative. This tiny ad knows what I'm talking about:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic