在将映射文件User.hbm.xml、Role.hbm.xml和Department.hbm.xml文件添加到hibernate.cfg.xml后用于自动生成数据库表的时候抛出以下异常:
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
抛出此异常的原因:
在User.hbm.xml的映射文件中properties name="phoneNumber"写成了
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>
<!-- roles属性 ,本类与Role的多对多的关系-->
</class>
</hibernate-mapping>
- 浏览: 213646 次
- 性别:
- 来自: 江西
最新评论
-
闷骚的小老头:
这个和eclipse右什么区别么,都会啊这个
如何在Android Studio中创建一个selector.xml文件 -
闷骚的小老头:
导入Model就ok
如何在Android Studio中导SlidingMenu框架到项目中 -
gaojingsong:
七天玩转oracle,韩顺平玩转oracle,有些东西过时了, ...
oracle表的数据类型
相关推荐
hibernate.cfg.xml hibernate框架的配置文件
由于spring对hibernate配置文件hibernate.cfg.xml的集成相当好,可以在项目中放弃hibernate.cfg.xml文件,介绍mappingLocations、mappingDirectoryLocations与mappingJarLocations的用法和区别
hibernate.cfg.xml文件详细解释收集的一个比较好的hibernate.cfg.xml文件解释
这是Hibernate的配置文件,hibernate.cfg.xml的具体写法,共友友们参考~~谢谢~
Hibernate配置文件hibernate.cfg.xml中配置信息详解!
hibernate配置文件hibernate.cfg.xml的详细解释
高级Hibernate4开发技术:ORM思想,hibernate介绍,hibernate.cfg.xml配置,hbm.xml映射文件详解,主键生成策略使用,PO对象状态及状态的转换分析、一级缓存,Hibernate数据检索技术,Hibernate高级映射技术,...
Hibernate.cfg.xml配置总结
hibernate.cfg.xml中各节点的所有属性值,取自hibernate官网,纯天然无污染。原装!
高级Hibernate4开发技术:ORM思想,hibernate介绍,hibernate.cfg.xml配置,hbm.xml映射文件详解,主键生成策略使用,PO对象状态及状态的转换分析、一级缓存,Hibernate数据检索技术,Hibernate高级映射技术,...
(hibernate调用C3p0)hibernate.cfg.xml
NULL 博文链接:https://15090079858-163-com.iteye.com/blog/1185564
activiti.cfg.xml和application.properties文件的整合配置,不能两个都存在,方便,适应