Hibernate 异常:Association references unmapped class

Hibernate 异常:

Invocation of init method failed; nested exception is org.hibernate.MappingException: Association references unmapped class

 

错误: 所有有跟这张表有关联的 .hbm.xml 的CLASS路径是否正确.

解决的方法:看各个包中的映射文件中的内容,如
<many-to-one name="district" class="db.basic.register.District" fetch="select">
            <column name="districtid" length="6" not-null="true" />
        </many-to-one>
        <many-to-one name="users" class="db.basic.register.Users" fetch="select">
            <column name="usersid" not-null="true" />
中的class 后面的路径是不是对,如果不对改过来即可

你可能感兴趣的:(Hibernate,exception,Class,nested)