NutzCN Logo
问答 关联查询, 关联对象都有条件
发布于 2710天前 作者 qq_7c6192dd 1939 次浏览 复制 上一个帖子 下一个帖子
标签: dao 关联

@Table("a_table") public class ATable { @Id private long id; @Column("username") private String username; @Column("bid") private long bid; @One(field = "bid", target = BTable.class) private BTable btable; } @Table("b_table") public class BTable { @Id private long id; @Column("title") private String title; } 有这样的查询: select * from a_table a, b_table b where a.bid=b.id and a.username='who' and b.title = 'this is title'; 请问如何实现查询结果为: List<ATable> list = ...
1 回复

先query然后fetchLinks是更好的选择, query和fetchLinks都可以带条件的

PS: 应该用left join.

添加回复
请先登陆
回到顶部