<!--解决数据库列名与实体对象属性名不一样的问题-->
<!--1.修改sql语句,起别名。,这种方式最为高效,不浪费性能,但是麻烦-->
<select id="findAll" resultType="com.domain.User">
select id as userId,username as userName,address as userAddress,sex as userSex,birthday as userBirthday from user;
</select>
<!--2.配置xml文件,开发方便.注意!需要把resultType改成resultMap,resultMap的值就是上面resultMap的id值
配置 查询结果的列名和实体类的属性名的对应关系-->
<resultMap id="userMap" type="uSeR">
<!--主键字段的对应:property实体对象属性名 column数据库列名-->
<id property="userId" column="id"></id>
<!--非主键字段的对应-->
<result property="userName" column="username"></result>
<result property="userAddress" column="address"></result>
<result property="userSex" column="sex"></result>
<result property="userBirthday" column="birthday"></result>
</resultMap>-->
<select id="findAll" resultMap="userMap">
select * from user;
</select>