I have database which has two tables
post:
id
post_name
post_desc
files:
file_id
file_name
post_attachments
post_id
As shown in the manual, you have to write a more complex query and change the mapper.
The request will be something like that :
<select id="selectPosts" resultType="com.mycom.myproject.bean.postBean">
select id, post_name, file_id, file_name as postName from post left outer join files
</select>
And your result map :
<resultMap id="detailedPostResultMap" type="Blog">
<result property="id" column="id"/>
<result property="name" column="post_name"/>
<collection property=filesAttachment" ofType="FileAttachment">
<id property="fileId" column="file_id"/>
<result property="fileName" column="file_name"/>
</collection>
</resultMap>