Mybatis中resultMap输出mapper中的配置
2017-01-02 18:41
459 查看
<mapper namespace="dancheng.mybatis.mapper.UserMapper"> <!-- 定义resultMap --> <!-- type:resultMap最终映射的java对象类型,可以使用别名 id:对resultMap的唯一标识 --> <resultMap type="user" id="userResultMap"> <!-- id表示查询结果集中的唯一标识 column:查询出来的列名 property:type指定的pojo类型中的属性名 最终resultMap对column和property做一个映射关系(对应关系) --> <id column="id_" property="id"/> <!-- result对扑通名映射定义 column:查询出来的列名 property:type指定的pojo类型中的属性名 最终resultMap对column和property做一个映射关系(对应关系) --> <result column="username_" property="username"/> </resultMap> <!-- 调用resultMap --> <!-- 使用resultMap进行输出的映射 如果这个resultMap的在其他mapper文件中,前面需要namespace --> <select id="findUserByIdResultMap" parameterType="int" resultType="userResultMap"> SELECT id id_,username username_ FROM USER WHERE id=#{value} </select> </mapper>
相关文章推荐
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- Mybatis 源码学习笔记(八)mapper映射文件配置之select、resultMap
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- 03_MyBatis基本查询,mapper文件的定义,测试代码的编写,resultMap配置返回值,sql片段配置,select标签标签中的内容介绍,配置使用二级缓存,使用别名的数据类型,条件查询ma
- 03_MyBatis基本查询,mapper文件的定义,测试代码的编写,resultMap配置返回值,sql片段配置,select标签标签中的内容介绍,配置使用二级缓存,使用别名的数据类型,条件查询ma
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- mybatis的mapper的配置文件的resultMap元素的用法和作用
- mybatis--mapper映射文件配置之select,resultMap
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- mybatis SqlMapper resultmap配置timestamp类型
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- 【Mybatis框架】输出映射-resultType与resultMap
- mybatis配置文件之resultMap和resultType
- mybits的mapper配置文件的resulttype需要和mybatis配置文件中alias对应
- [mybatis]ResultMap输出结果映射
- MyBatis(IncompleteElementException: Could not find result map com.hao.mapper.PersonTestMapper.=Base)
- mybatis3.0 配置等值连接两种方式:resultMap和resulttype