zoukankan      html  css  js  c++  java
  • 关于映射异常org.hibernate.MappingException: An association from the table DUTY_INFO refers to an unmapped class: com.pms.entities.other.Department的原因。

    在编程过程当中由于修改过了包名。

    原来的包名是: com.pms.entities.base

    然后改为了:com.pms.entities.other

    当我重新映射生成数据表的时候就报错:org.hibernate.MappingException: An association from the table DUTY_INFO refers to an unmapped class: com.pms.entities.other.Department

    我明明已经修改过了类对应的映射文件,而且准确无误。一直找不到原因。

    最后发现是,IOC容器中的配置没有改。

    原来的配置如下。

    <!-- 配置SessionFactory -->
        <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
            <property name="dataSource" ref="dataSource"></property>
            <property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
            <property name="mappingLocations" >
                <list>
                    <value>classpath:com/pms/entities/base/*.hbm.xml</value>           <!-- 这里原来的包名应该也要改,这里只要改成other就好了。 -->
                    <value>classpath:com/pms/entities/personnelManagement/*.hbm.xml</value>
                    <value>classpath:com/pms/entities/treatmentManagement/*.hbm.xml</value>
                </list>
            </property>
        </bean>
  • 相关阅读:
    25-javaweb接入支付宝支付接口
    4-js 函数
    24-filter-拦截器
    23-新建maven 项目
    22-maven-安装与配置
    15-matlab矩阵运用
    2018.7.18 div,section,article的区别和使用
    2018.7.17 牛客网训练
    2018.7.16常用推荐算法
    2018.7.15 解决css中input输入框点击时去掉外边框方法
  • 原文地址:https://www.cnblogs.com/GooPolaris/p/7919066.html
Copyright © 2011-2022 走看看