This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 17249
    
    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: 17249
    
    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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: org.hibernate.MappingException: Unknown entity
 
Similar Threads
org.hibernate.MappingException: Unknown entity:
HibernateException: No Hibernate Session bound to thread
Hibernate : Empty Table recreated when spring starts
Error with Transaction Interceptor
data not persisted using hibernate spring integration