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刪除。