본문 바로가기
DB/Mybatis

VO를 포함한 VO형태 사용방법

by fabxoe 2020. 2. 14.
<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

댓글