1、resultType
resultType属性:在执行select时使用。作为<select>标签的属性出现的。
resultType:表示结果类型,mysql执行sql语句得到java对象的类型。
它的两种值:
1、Java类型的全限定名称
2、使用别名
2、resultMap的使用
<resultMap id ="customMap" type="com.bipow.vo.CustomObject">
<!--定义列名和属性名的对应-->
<!--主键类型使用id标签-->
<id column="id" property="cid">
<!--非主键类型使用result标签-->
<result column="name" property="cname">
<!-列名和属性名相同不用定义-->
<result column="email" property="email">
<result column="age" property="age">
</resultMap>
<!--使用resultMap属性,指定映射关系的id
-->
<select id="selectById2" resultMap="customMap">
select id,name,email,age from student where id=#{stuid}
</select>