简体   繁体   中英

Spring 3 MVC Validation with Hibernate; error: org.hibernate.MappingException: Unknown entity

I am just learning Spring3 Validation with Hibernate. I have this class but I am setting getting the following error

org.hibernate.MappingException: Unknown entity: com.stutteringjohnsmith.model.Friend

I am doing the sample from

http://www.roseindia.net/tutorial/spring/spring3/web/spring-3-mvc-and-hibernate3-example-part1.html

but I change the Article to Friend! Please help me out

Old question, but for google's sake I wanted to give a suggestion: check your persistence.xml file to make sure there's a mapping for the class in question. In this case, there should be an entry as follows:

<persistence ...>
   <persistence-unit name="..." ...>
      <provider>...</provider>
      <class>com.sutteringjohnsmith.model.Friend</class>
   </persistence-unit>
</persistence>

Hope that helps someone...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM