MyBatis嵌套对象中的List查询


  • <resultMap id="myDept" type="com.stayreal.mybatis.Department">
    <id column="did" property="id"/>
    <result column="dept_name" property="name"/>
    <!-- collection定义关联集合类型的属性封装规则
    offType:指定集合中的元素类型
    -->
    <collection property="employees" ofType="com.stayreal.mybatis.Employee">
    <id column="eid" property="id"/>
    <result column="last_name" property="lastName"/>
    <result column="email" property="email"/>
    <result column="gender" property="gender"/>
    </collection>


  • 免责声明!

    本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。