Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

org.hibernate.MappingException: Unknown entity

 
Frank VanOor
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • 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

 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic