* xxDAO.java

 

...

return (전체VO)select( "조회DAO.get전체목록", ... );

 

 

* xxsql.xml

 

<typeAlias  alias="전체VO" type="com...전체VO"/>

<typeAlias  alias="서브VO" type="com...서브VO"/>

 

<resultMap id="전체Map" class="전체VO">

    <result property="..." column="..."/>

    <result property="서브목록" column="서브조회Column" select="get서브목록"/>

                            ~~~~~~

                            전체VO class에 private List<서브VO> 서브목록; 으로 선언되어있어야 한다. 당연히.

</resultMap>

 

<select id="조회DAO.get전체목록" parameterClass="..." resultMap="전체Map">

    SELECT ...

    FROM    ...

    WHERE  ...

</select>

 

<select id="get서브목록" parameterClass="서브조회Column Type" resultClass="서브VO">

    SELECT ...

    FROM    ...

    WHERE  ...

</select>

 

 

+ Recent posts