Hi,
There is no way to pass the original parameter object to the nested
select, but you can pass multiple parameters.
Assuming that GET_DEPTS needs two parameters 'employeeId' and
'country' and GET_EMPLOYEE returns ID and COUNTRY as its results:
@Select(GET_EMPLOYEE)
@Results(value = {
@Result(property="id", column="ID"),
@Result(property="dept", column="{employeeId=ID,country=COUNTRY}",
javaType=List.class, many=@Many(select="getDepts"))
})
public Employee getEmployee(Object param);
@Select("select * from dept where employee_id = #{employeeId} and
country = #{country}")
@Results(value = {
@Result(property="id", column="ID"),
@Result(property="deptName", column="NAME")
})
public Employee getDepts(Map params);
Note that the parameter type of the nested select is now java.util.Map.
Hope this helps,
Iwao
2013/5/16 Micky <
viren....@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups
> "mybatis-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
mybatis-user...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>