The following exception is thrown when the mapping files User.hbm.xml, Role.hbm.xml and Department.hbm.xml are added to hibernate.cfg.xml to automatically generate database tables:
org.springframework.beans.factory .BeanCreationException : Error creating bean with name 'roleDaoImpl': Injection of resource fields failed; nested exception is 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.InvalidMappingException: Could not parse mapping document from resource com/jxust/oa/domain/
User.hbm.xml In the file properties name="phoneNumber" is written as
properties name="phoneNumbers"
<hibernate-mapping package="com.jxust.oa.domain">
<class name="User" table="jxust_user">
<id name="id">
<generator class="native" />
</id>
<property name="loginName" />
<property name="password" />
<property name="name" />
<property name="gender" />
<property name="phoneNumber" />
<property name="email" />
<property name="description" />
<!-- department属性,本类与Department的多对一的关系 -->
<many-to-one name="department"class="Department" column="departmentId"></many-to-one> </hibernate-mapping> </class>
<!-- roles attribute, many-to-many relationship between this class and Role -->
Exception thrown after mapping file is added to hibernate.cfg.xml
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=326987455&siteId=291194637
Ranking