<resultMap id="StudentTeacher" type="Student"> <result property="id" column="id"></result> <result property="name" column="name"></result> //对于复杂的属性要单独处理,如果是对象的话用association,集合的话用collection //property对应的实体类里面的,column对应的数据库里面 //对象的类型javaType="Teacher",select="getTeacher"查出的对象tid要干嘛 <association property="Teacher" column="tid" javaType="Teacher" select="getTeacher"/> </resultMap>