<resultMap id="userMap" type="com.test.model.User"> <id column="id" property="id"/> <result column="first_name" property="firstName"/> <result column="last_name" property="lastName"/> <collection property="roles" ofType="com.test.model.Role"> <result column="user_id" property="userId"/> <result column="role_type" property="roleType"/> </collection></resultMap>
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/5935f793-ac22-4875-af55-366361e9474a%40googlegroups.com.
<select id="getUsers" resultMap="userMap">
select * from test_user u
left join test_role r
on r.user_id = u.id
</select>
Yes, see section 6, Mapper Annotations, in the MyBatis User Guide. I just noticed there are a whole bunch of sections 6 (oops!); search for "Mapper Annotations", and then within that, take a look at the @Many annotation.--Guy RouillierOn 11/29/2019 5:09:16 PM, "Piotr Ponikowski" <piotrpon...@gmail.com> wrote:
Is it possible to use collections/assocations with annotation-based configuration?--For example can below mapping be converted to annotations?
<resultMap id="userMap" type="com.test.model.User"><id column="id" property="id"/><result column="first_name" property="firstName"/><result column="last_name" property="lastName"/><collection property="roles" ofType="com.test.model.Role"><result column="user_id" property="userId"/><result column="role_type" property="roleType"/></collection></resultMap>
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybati...@googlegroups.com.