mybatis3.3 配置嵌套查询时,无法调用关联的select

<resultMap type="com.rr.one2many.Department" id="deptMap">
    <id property="id" column="id"/>
    <result property="name" column="name"/>
    <!-- <collection property="emps" ofType="com.rr.one2many.Employee" javaType="java.util.ArrayList" column="id" select="empNamespace.findEmpById"></collection>
     -->
     <collection property="emps" column="id" select="findEmpById" ></collection>
</resultMap>

<select id="findAll" resultType="com.rr.one2many.Department">
    select * from department
</select>

<select id="findById" parameterType="int" resultType="com.rr.one2many.Department">
    select id,name from department where id=#{id}
</select>

<select id="findEmpById" parameterType="int" resultType="com.rr.one2many.Employee">
    select * from employee where depId=#{id}
</select>

<select id="findEmpById" parameterType="int" resultType="com.rr.one2many.Employee">
    select * from employee where depId=#{id}
</select>

<select id="findEmpByEmpId" parameterType="int" resultType="com.rr.one2many.Employee">
    select id,name,depId from employee where id=#{id}
</select>

<resultMap type="com.rr.one2many.Employee" id="empMap">
    <id property="id" column="id"/>
    <result property="name" column="name"/>
    <result property="age" column="age"/>
    <association property="dept" javaType="com.rr.one2many.Department" column="depId" select="deptNamespace.findById"></association>
</resultMap>

员工表和部门表,查询部门时,获取关联的员工,或者查询员工时,获取关联的部门。但是执行某个select时,不会执行关联select。
比如,执行findEmpByEmpId,但是assocation中select对应的deptNamespace.findById"不执行
没有使用懒加载

select中resultType改成对应的resultMap
你这样写当然不会执行了,返回均为实体,根本没有走自定义的resultMap,又怎么能执行assocation呢?


select * from department

改为

select * from department


<select id="findAll" resultType="com.rr.one2many.Department">
    select * from department
</select>

改为


<select id="findAll" resultType="deptMap">
    select * from department
</select>