【问题标题】:Spring 3 MVC Validation with Hibernate; error: org.hibernate.MappingException: Unknown entitySpring 3 MVC 验证与 Hibernate;错误:org.hibernate.MappingException:未知实体
【发布时间】:2013-04-30 03:28:12
【问题描述】:

我只是在学习 Spring3 Validation with Hibernate。我有这门课,但我设置得到以下错误

org.hibernate.MappingException:未知实体:com.stutteringjohnsmith.model.Friend

我正在做样本

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

但我将文章更改为朋友!请帮帮我

【问题讨论】:

  • 在进行了一些调试后,我看到 sessionFactory.getCurrentSession().saveOrUpdate(friend); 中出现错误这是DAO中的所有方式..有人可以帮我吗

标签: hibernate spring-mvc


【解决方案1】:

老问题,但为了谷歌的缘故,我想提出一个建议:检查您的 persistence.xml 文件以确保存在相关类的映射。在这种情况下,应该有如下条目:

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

希望对某人有所帮助...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-09-06
    • 2015-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-29
    相关资源
    最近更新 更多