日期:2014-05-19  浏览次数:20710 次

帮忙看一下是哪的错
折腾了好几天了还没解决,帮忙看一下吧,谢谢了

错误信息:
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource com\zhao\oa\model\Person.hbm.xml
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:4009)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXmlQueue(Configuration.java:3998)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3986)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1398)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1375)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:717)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398)
... 23 more


Caused by: org.hibernate.PropertyNotFoundException: field [org] not found on com.zhao.oa.model.Person
at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:182)
at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:174)
at org.hibernate.property.DirectPropertyAccessor.getGetter(DirectPropertyAccessor.java:197)
at org.hibernate.util.ReflectHelper.getter(ReflectHelper.java:241)
at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:229)
at org.hibernate.mapping.ToOne.setTypeUsingReflection(ToOne.java:81)
at org.hibernate.cfg.HbmBinder.createProperty(HbmBinder.java:2297)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2274)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2164)
at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:412)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:326)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:177)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:4006)
... 31 more


Person.hbm.xml配置文件:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
  "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping >

<class name="com.zhao.oa.model.Person" table="t_person" >
<id name="id">
<generator class="native"/>
</id>
<property name="name"/>
<property name="sex"/>
<property name="age"/>
<property name="address"/>
<property name="duty"/>
<property name="phone"/>
<many-to-one name="org"></many-to-one>
  </class>

</hibernate-mapping>

Person实体类:
public class Person {
  private int id;
  private String name;
  private int age;
  private String sex;
  private String address;
  private String duty;
  private String phone;
  private Organization organization;
public int getId()