[英]How to write join fetch query with jooq?
Anyone knows how to write join fetch query with jooq ? 任何人都知道如何用jooq编写连接获取查询? my code : 我的代码:
int oid=5;
Select<?> selectQuery = DSL_CONTEXT.select().from(TABLE_A)
.join(TABLE_B).on(TABLE_A.PID.eq(TABLE_B.ID))
.where(TABLE_A.OID.eq(oid))
.orderBy(UPDATED.asc(), ID.asc())
.seekAfter(val(offsetDateTime), val(id))
.limit(50);
this results in : select * from table_a join table_b
type of query. 这导致: select * from table_a join table_b
类型的查询。 How to make it create a query of following type : 如何使它创建以下类型的查询:
select * from table_a join fetch table b ...
Any help is appreciated. 任何帮助表示赞赏。
The closest you can get with jOOQ 3.11 out of the box functionality is using ResultQuery.fetchGroups()
. 使用JOOQ 3.11开箱即用的功能最接近的是使用ResultQuery.fetchGroups()
。 On your query, call: 在您的查询中,请致电:
Map<TableARecord, Result<TableBRecord>> result = select.fetchGroups(TABLE_A, TABLE_B);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.