第一种解决方法:在sql中使用别名 <select id="getRoleList" resultType="com.ttpfx.domain.Role"> select ID as id, ROLE_NAME as name, ROLE_DESC as description from role; </select> 第二种解决方法:使用resultMap <?xml version="1.0" encoding=
5.解决属性名和字段名不一致的问题 1.问题 数据库中的字段 新建一个项目,拷贝之前的,测试实体类字段不一致的情况. public class User { private int id; private String name; private String pwd; } //select * from mybatis.user where id = #{id} //类型处理器 //select id,name,pwd from mybatis.user where id = #{id} 解决