How does work foreign key relations in JOOQ? Let me clarify a bit:
In code you can call a method to access main table using foreign table B.a().
Let's say I am calling
dsl.select(B.a().ID).from(B).fetchInto(String.class);
Does it use left join inside the box of JOOQ?
Implicit path joins default to using a LEFT JOIN
if your foreign key is nullable, and INNER JOIN
if your foreign key is non-nullable.
The default type of join that is generated is:
INNER JOIN
for to-one path segments with non-nullable parentLEFT JOIN
for to-one path segments with nullable parent
But you can override this behaviour if you always prefer a LEFT JOIN
, for example:
Settings settings = new Settings()
.withRenderImplicitJoinType(RenderImplicitJoinType.LEFT_JOIN);