2011-03-25 61 views
0

我剛剛學習Hibernate的Spring3驗證。我有這個類,但我設置收到以下錯誤Spring 3 MVC Validation with Hibernate;錯誤:org.hibernate.MappingException:未知實體

org.hibernate.MappingException:未知實體:com.stutteringjohnsmith.model.Friend

我從

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

做樣本

,但我把文章改爲朋友!請幫助我

+0

做一些調試我看到我在\t \t sessionFactory.getCurrentSession()得到錯誤後saveOrUpdate(朋友);這是在DAO中的所有方式..有人可以幫助我 – SJS 2011-03-25 23:15:41

回答

0

老問題,但爲了google的緣故,我想給出一個建議:檢查你的persistence.xml文件以確保有問題的類的映射。在這種情況下,應該有一個條目,如下所示:

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

希望幫助別人......

相關問題