Meaningless Drivel is fun!*
The moose likes Object Relational Mapping and the fly likes Problem with: org.hibernate.mappingException: Unknown entity: Person 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 » Databases » Object Relational Mapping
Bookmark "Problem with: org.hibernate.mappingException: Unknown entity: Person" Watch "Problem with: org.hibernate.mappingException: Unknown entity: Person" New topic
Author

Problem with: org.hibernate.mappingException: Unknown entity: Person

Anna Udawska
Greenhorn

Joined: Apr 18, 2010
Posts: 2
First, I wanted to point out that I was looking for solutions to my problem in Google and here - but I wasn't able to find it, so I decided to write this post. (I have spend already many hours on this, and I am sooo angry...)

Here is my problem, I am trying to connect my Spring+Hibernate application with derby, but when I run tests (JUnit) I get this error:


And here are some improtant parts of code:

Class Person


Person.hbm.xml (in this same package as the class)


dao-context.xml


JUnit Test

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

How are you running the tests? How is the classpath set?
Anna Udawska
Greenhorn

Joined: Apr 18, 2010
Posts: 2
I run this program in NetBeans. I test it in 'normal' way: Right click on the project -> test.


I have changed code in sessionFactory to this:



But now the test is throwing:


The strange thing is that, when I am not using this test file, and when I try to run this application, everything is working just fine (Netbeans doesn't throw any exception about this file, so it sees it)

Help...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem with: org.hibernate.mappingException: Unknown entity: Person