例如,Student.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap
PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<!--***************************************************************************************************-->
<sqlMap>
<!--1. typeAlias-->
<typeAlias alias="Student" type="com.name.pojo.Student"/>
<!--2. resultMap-->
<resultMap id="fullStudentMap" class="student">
<result property="studentId" column="STUDENT_ID"/>
<result property="personId" column="PERSON_ID"/>
<result property="passwd" column="PASSWD"/>
</resultMap>
<!--3. parameterMap-->
<parameterMap class="com.name.pojo.Student" id="studentMap">
<parameter property="studentId" jdbcType="VARCHAR"/>
<parameter property="personId" jdbcType="VARCHAR"/>
<parameter property="passwd" jdbcType="VARCHAR"/>
</parameterMap>
<!--4. CRUD-->
<select id="findStuByStuId" parameterClass="String" resultMap="fullStudentMap">
<![CDATA[
select * from students where STUDENT_ID=#stuId#
]]>
</select>
</sqlMap>