求助!!!!

来源:2-9 验证Sevice

小豪同学

2019-09-08

老师,Areadao.xml中关于这

<select id="queryArea" resultType="com.imooc.o2o.entity.Area">
		SELECT area_id, area_name,
		priority, create_time, last_edit_time
		FROM tb_area
		ORDER BY priority
		DESC
	</select>

我觉得这里得用resultmap啊,不然怎么映射到area实体上??属性和字段部对应吗。

写回答

1回答

翔仔

2019-09-08

同学好,你可以直接试一下,就会发现这个也照样可行,因为是单一的实体类不需要用resultmap,比如它会自动将create_time解析为createTime,而你resultType="com.imooc.o2o.entity.Area"也就是说createTime是Area的属性,会被自动转换:)

0
0

Java双版本(SSM到SpringBoot)校园商铺全栈开发

SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需

5128 学习 · 8152 问题

查看课程