JOOQ 连接两个具有相同列名的表

JOOQ join two tables with same column names

我正在使用 运行 以下 JOOQ 查询:

dsl.select().from(table).join(joinTable).on(joinCondition).where(condition).fetchInto(entityClass);

table 和 joinTable 都将 id 作为主键名称,但结果提取到实体 class 中包含 joinTable 的 id,以及 table 的其余列。如果我重新排序 tables,结果是相似的,我有来自 table 的 ID 和来自 joinTable.

的其余列

元模型是使用 jooq-codegen-maven 插件生成的。 有趣的是,我发现使用:

dsl.select(table.fields())...

解决问题。我希望这种行为是默认的,但事实并非如此。