我有以下两门课
public class User {
private String id;
private String name;
private List<Account> accounts
}
public class Account {
private String id;
}我有下面的resultMap
<resultMap id="User" type="User">
<result property="id" column="id"/>
<result property="name" column="name"/>
<collection property="accounts" ofType="Account">
<result property="id" column="accont_id"/>
</collection>
</resultMap>我有两个表user和user_account
如何使用myBatis使所有字段都包含一个调用的用户
发布于 2015-11-25 12:25:06
您需要使用id标记而不是结果标记来标记父对象中的id属性。
<resultMap id="User" type="User">
<id property="id" column="id"/>
<result property="name" column="name"/>
<collection property="accounts" ofType="Account">
<result property="id" column="accont_id"/>
</collection>
</resultMap>https://stackoverflow.com/questions/33905474
复制相似问题