整合ssh Hibernate one2many 报:org.springframework.beans.factory.BeanCreationException: Error creating b

department1.报:An association from the table employee refers to an unmapped class: com.ht.domain. 

   看下applicationContext.xml下

<property name="mappingResources">
        <list>
                   <value>com/ht/domain/Employee.hbm.xml</value>
                   <value>com/ht/domain/Department.hbm.xml</value>

        </list>
</property>

粗体字<value>标签是否完全

2.报:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table employee refers to an unmapped class: com.ht.domain.XXX

<property name="department" type="com.ht.domain.Department" column="emp_department" />
改成
<many-to-one name="department" column="dept_id" />

不能把department当成普通属性对待.







你可能感兴趣的:(spring,Hibernate,Hibernate,one-to-many)