日期:2014-05-17  浏览次数:20900 次

hibernate+spring save的时候为什么报nested exception is org.hibernate.MappingException:
org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: com.setecusa.hibernate.tblinventorylog.Tblinventorylog; nested exception is org.hibernate.MappingException: Unknown entity: com.setecusa.hibernate.tblinventorylog.Tblinventorylog


//-----这是配置文件---
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- 
  Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
  <class name="com.setecusa.hibernate.tblinventorylog.Tblinventorylog" table="tblInventoryLog" lazy="false">
  <id name="fldId" type="java.lang.Integer">
  <column name="fldId"/>
  <generator class="increment"/>
  </id>
   
  <property name="fldPid" type="java.lang.Integer">
  <column name="fldPid"/> 
  </property>
   
  <property name="fldCustomLabel" type="java.lang.String">
  <column name="fldCustomLabel"/> 
  </property>
   
  <property name="fldDate" type="java.lang.String">
  <column name="fldDate"/> 
  </property>
   
  <property name="fldQty" type="java.lang.Integer">
  <column name="fldQty"/> 
  </property>
   
  <property name="fldUnitsCost" type="java.lang.Double">
  <column name="fldUnitsCost"/> 
  </property>
  </class>
   
</hibernate-mapping>


我没发现哪里配错了呀。这是什么原因。。。急,,,,卡一天了。

------解决方案--------------------
com.setecusa.hibernate.tblinventorylog.Tblinventorylog
这个写错了,或者路径不对,这个是实体类
------解决方案--------------------
没看到哪错误了!给你一个解决方案!
把你数据库中相应的表删除,然后在applicationContext.xml中加上
<property name = "hibernate.hbm2ddl.auto" value = "update"/>
然后在去运行,试一试