日期:2014-05-18  浏览次数:20783 次

org.hibernate.MappingNotFoundException: resource: net.itaem.bean/HomeNews.hbm.xm
<?xml version='1.0' encoding='UTF-8'?>
  <!DOCTYPE hibernate-configuration PUBLIC
  "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
  "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
  <hibernate-configuration>
  <session-factory>
  <!--Examda提示:数据库用户名-->
  <property name="connection.username">root</property>
  <!--数据库URL-->
  <property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/news_wire
</property>
<property name="dialect">
org.hibernate.dialect.MySQLInnoDBDialect
</property>
<property name="connection.username">
itaem
</property>
<property name="connection.password">
imitaem
</property>
<property name="show_sql">
false
</property>

  <mapping resource="bean/HomeNews.hbm.xml" />
  </session-factory>
  </hibernate-configuration>
hibernate

------解决方案--------------------

<mapping resource="net/itaem/bean/HomeNews.hbm.xml"/>

hibernate配置文件里面这样写试下
------解决方案--------------------
config.addClass(HomeNews.class);
sessionFactory = config.buildSessionFactory();
是不是加载重复了,配置文件中有HomeNews,又重新编码加入。 试试删除上一句代码