0

I currently have this result map:

 <resultMap id="one" type="FirstType" autoMapping="true">
        <collection property="listProp" column="example_id" 
           ofType="SecondType" select="subQuery">
        </collection>
    </resultMap>

Dao:

    List<FirstType> one(@Param("params") ParamObject obj);

I can access the param object in my parent query and it's all good but I can't access it in my sub query. Is it possible to pass the obj param to subquery?

dev-rifaii
  • 217
  • 2
  • 9
  • The `subQuery` receives the value of `column`. Please see the explanation about "nested select" in the [doc](https://mybatis.org/mybatis-3/sqlmap-xml.html). – ave Sep 21 '22 at 17:10
  • @ave I know that. I don't think you understood what I'm trying to do. I want to pass obj to the nested query. – dev-rifaii Sep 21 '22 at 17:55
  • I am pretty sure I do. See this [answer](https://stackoverflow.com/a/25324271/1261766). – ave Sep 21 '22 at 18:58
  • it does not let me simply pass the object. If I want to pass it I would need to do [this](https://stackoverflow.com/a/25324271/19957114) for every field in the pojo – dev-rifaii Sep 22 '22 at 06:21
  • Yes, that is correct. – ave Sep 22 '22 at 07:05

0 Answers0