一对多和多对多类似
<resultMap id="departmentMap" type="com.qf.pojo.Department">
<id property="id" column="id"></id>
<result property="name" column="name"></result>
<result property="location" column="location"></result>
<!-- 多的一方
collection -> ofType
-->
<collection property="employeeList" ofType="com.qf.pojo.Employee">
<id property="id" column="emp_id"></id>
<result property="name" column="emp_name"></result>
<result property="salary" column="salary"></result>
</collection>
</resultMap>
和一对一的区别是 :一对一 用的是<association></association>标签 里面的属性是JavaType
多对多 使用的是 <collection></collection>标签 里面的属性是ofType 。