<resultMap id="boradResult" type="net.krespo.mybatis.Board">
<result property="boardid" column="BOARDID"/>
<result property="title" column="TITLE"/>
<result property="content" column="CONTENT"/>
<collection property="comments" column="BOARDID" javaType="java.util.ArrayList" ofType="net.krespo.mybatis.Comment" select="getCommentListById"/>
</resultMap>
<select id="getBoardById" resultMap="boardResult">
SELECT boardid, title, content FROM board WHERE boardid = #{boardid}
</select>
<select id="getCommentListById" resultType="net.krespo.mybatis.Comment">
SELECT commentid, boardid, writer, content FROM comment WHERE boardid = #{boardid
https://krespo.net/162
댓글