2020
10-28
10-28
Mybatis实体类属性与数据库不一致解决方案
当实体类属性和数据库不一致时,使用mybatis查询数据库返回实体类自动封装就会出现问题。针对这种情况,有两种解决方案。1、使用别名查询<!--配置查询所有操作--><selectid="findAll"resultType="com.itheima.domain.User">selectidasuserId,usernameasuserName,birthdayasuserBirthday,sexasuserSex,addressasuserAddressfromuser</select>优点:查询效率高缺点:如果我们的查询很多,都使用别名的话写起来很麻...
继续阅读 >