当前位置: 代码迷 >> J2EE >> org.hibernate.MappingNotFoundException: resource: net.itaem.bean/HomeNews.hbm.xm,该如何解决
  详细解决方案

org.hibernate.MappingNotFoundException: resource: net.itaem.bean/HomeNews.hbm.xm,该如何解决

热度:94   发布时间:2016-04-17 23:06:32.0
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>
------解决思路----------------------

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

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