2.An association from the table refers to an unmapped class:错误

来源:互联网 发布:java 强引用 弱引用 编辑:程序博客网 时间:2024/05/17 22:35

出现这个错误从下面4个方面入手检查:

1、检查你的hibernate.cfg.xml文件中是否添加了  <mapping resource="xxxx.hbm.xml"/> 


2、检查你的hibernate.cfg.xml文件中的相关联的两个<mapping resource=""/>的顺序,可能有其中一个需要引用另一个,但是另一个却还没有编译,就是说被用作外键的表要放在前面


3、检查你的*.hbm.xml文件名是否正确


4、检查你的*.hbm.xml里面类全名是不是补齐全了 


我出的错误是<many-to-one name="person"class="org.app.domain.Person"
               column="person_id" not-null="true"/>  在class属性中的domain写成了domian。。一定要注意。

原创粉丝点击