nested exception is org.hibernate.MappingException解决方案
2024-08-25 04:15:15
1.可能是因为映射文件( Order.hbm.xm)配置的class路径出错
- <hibernate-mapping>
- <class name="com.web.bean.Order" table="order">
- <id name="orderId" type="java.lang.Integer" column="order_id">
- <generator class="increment"></generator>
- </id>
- <property name="price" type="double" column="order_price" length="12"></property>
- <property name="quantity" type="int" column="order_quantity"></property>
- <property name="date" type="date" column="date" length="10"></property>
- <many-to-one name="seller" column="seller_id" class="com.web.bean.Seller"
- not-null="true">
- </many-to-one>
- <many-to-one name="phone" column="phone_id" class="com.web.bean.Phone"
- not-null="true">
- </many-to-one>
- <many-to-one name="customer" column="customer_id" class="com.web.bean.Customer"
- not-null="true">
- </many-to-one>
- </class>
- </hibernate-mapping>
类的路径必须写全,或者在<hibernate-mapping>中加上属性package="com.web.bean"
2.如果以上检查都是对的,那么就看applicationContext.xml中是否加上了
<value>com/web/bean/Order.hbm.xml</value>
- <property name="mappingResources">
- <list>
- <value>com/web/bean/Customer.hbm.xml</value>
- <value>com/web/bean/Seller.hbm.xml</value>
- <value>com/web/bean/Brand.hbm.xml</value>
- <value>com/web/bean/Kind.hbm.xml</value>
- <value>com/web/bean/Order.hbm.xml</value>
- <value>com/web/bean/Phone.hbm.xml</value>
- <value>com/web/bean/SellerOwnPhone.hbm.xml</value>
- </list>
- </property>
最新文章
- Windows系统盘占用空间分析
- ITEXTSHARP学习整理
- 基于visual Studio2013解决C语言竞赛题之1007找数
- asp.net mvc 上传下载文件的几种方式
- input、button、a标签 等定义的按钮尺寸的兼容性问题
- 用Java语言实现简单的词法分析器
- 集成学习(ensemble learning)
- vue.js个人学习心得
- 浅谈iOS学习之路(转)
- linux 用户/用户组添加修改删除(ubuntu/centos)
- 20155337 2016-2017-2 《Java程序设计》第一周学习总结
- ref:Web Service 渗透测试从入门到精通
- [知识整理]Linux系统WIFI知识的一些整理
- 2016级算法第一次练习赛-C.斐波那契进阶
- C#自动给文章关键字加链接实现代码
- Spring Mvc中@ResponseBody中文乱码解决,以及修改返回的Content-Type
- Kernel list_head demo实现
- HDU 4649 Professor Tian (概率DP)
- [python]变量和赋值
- Modbus协议笔记