wood burning stoves 2.0*
The moose likes Spring and the fly likes org.hibernate.MappingException: Unknown entity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "org.hibernate.MappingException: Unknown entity" Watch "org.hibernate.MappingException: Unknown entity" New topic
Author

org.hibernate.MappingException: Unknown entity

Frank VanOor
Ranch Hand

Joined: Jun 18, 2004
Posts: 49
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

Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Frank VanOor
Ranch Hand

Joined: Jun 18, 2004
Posts: 49
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
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: org.hibernate.MappingException: Unknown entity