在做hibernate 多对一 java.lang.IllegalArgumentException: argument type mismatch

yunlong167167 yunlong167167 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
在做hibernate 多对一程序时,出现以下异常 java.lang.IllegalArgumentException: argument type mismatch;
代码: 一个酒店里面有多个房间
/**
* 酒店实体
*
* @author:xyl
* @E-mail: yunlong167167@163.com
* @since:2010-6-11 下午05:22:52
*
*/
public class Hotel
{
private int id;
/**
* 酒店名称
*/
private String hotelName;
//get set 省略
}
**
* 酒店房间实体
*
* @author:xyl
* @E-mail: yunlong167167@163.com
* @since:2010-6-12 上午10:21:10
*
*/
public class HotelRoom
{
/**
* id
*/
private String id;
/**
* 户型
*/
private String houseType;
/**
* 酒店ID
*/
private Hotel hotel;
//get set 省略
}
HotelRoom.hbm.xml
<class name="com.hnt66.pojo.HotelRoom" table="hotelroom">
<id name="id" type="java.lang.Integer">
<column name="id" />
<generator class="identity" />
</id>
<many-to-one column="hotelId" name="hotel" cascade="save-update"
class="com.hnt66.pojo.Hotel" not-null="true" />
<property name="houseType" type="string">
<column name="houseType" length="50" />
配置大概是上面那样,
然后在action中添加数据
public String add()
{
if (StringUtils.isNotBlank(hId))
{
hotel= hotelService.getHotelById(Integer.parseInt(hId));//获得酒店实体
this.hotelRoomService.save(hotel, houseType, area, floor,
directions, bedType, counterPrice, frontPrice, breakfast,
broadband, amount, paymentType, priceMark, isRecommend,
imgUrl);
}
return "add";
}
serevice 层的代码如下:
public void save(Hotel hotelId, String houseType, String area,
String floor, String directions, String bedType,
String counterPrice, String frontPrice, String breakfast,
String broadband, String amount, String paymentType,
String priceMark, String isRecommend, String imgUrl)
{
HotelRoom hotelRoom = new HotelRoom();
hotelRoom.setHotel(hotelId);
hotelRoom.setHouseType(houseType);
//......
}
代码哪里写的有问题,哪位朋友帮忙说下
...全文

相关推荐

WEB开发报错处理集锦

Hibernate JSP Struts 等 多个软件开发中报错处理集锦 对初学者 初开发者 都有很大帮助 希望大家在开发中出错的开一下再下来看一看 应该很有用的

canghaizixia

29Linux基础命令详解——用户管理.docx

29Linux基础命令详解——用户管理

云计算练习生

科技服务机构如何通过数据分析增强服务竞争力?.docx

科易网基于40亿+科创知识图谱数据库,深度探索AI技术在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,研究科技创新领域的AI+数智化解决方案,推动科技创新与产业创新智能化发展。

BIZKEEN

vue+springboot基于 Java 的南昌实利广告公司的员工管理系统的设计与实现_oj680rl3毕业设计源码数据库.zip

vue+springboot基于 Java 的南昌实利广告公司的员工管理系统的设计与实现_oj680rl3毕业设计源码数据库.zip

源码论文专家

车辆缺陷分割数据集4000张json格式.zip

数据集格式:labelme格式(不包含mask文件,仅仅包含jpg图片和对应的json文件) 图片数量(jpg文件个数):4000 标注数量(json文件个数):4000 标注类别数:1 标注类别名称:["defect"] 每个类别标注的框数: defect count = 8740 总框数:8740 使用标注工具:labelme=5.5.0 所在仓库:firc-dataset 图片分辨率:640x640 标注规则:对类别进行画多边形框polygon 重要说明:可以将数据集用labelme打开编辑,json数据集需自己转成mask或者yolo格式或者coco格式作语义分割或者实例分割 特别声明:本数据集不对训练的模型或者权重文件精度作任何保证

不会仰游的河马君
评论 1
收藏 已收藏
分享
返回顶部
yunlong167167
Ajax 52,778 成员 25,334 内容