`
ldzyz007
  • 浏览: 700120 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

ibatis数据库字段带下划线(_)映射与java类不一致

    博客分类:
  • java
阅读更多
ibatis数据库字段带下划线(_)与java pojo对象映射的时候,如果两边不一致,会导致数据无法读取。
解决办法:1.将两边字段搞成一致的
          2.做如下映射配置,加入parameterClass="java.util.Map"

<typeAlias alias="user" type="com.ibatis.User"/>
<resultMap id="userMap" class="user">
    <result property="userPic" column="user_pic" nullValue="0"/>
</resultMap>

<select id="getMonthlySkuSaleMoneyMap"
        parameterClass="java.util.Map" resultMap="userMap">
select user_pic from table
</select>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics