|previous : next|
This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.
Implicit join type
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
jOOQ's very useful implicit JOIN feature can be used to use a path notation to join tables on their actual, or synthetic foreign keys. For example:
// Get all books, their authors, and their respective language create.select( BOOK.author().FIRST_NAME, BOOK.author().LAST_NAME, BOOK.TITLE, BOOK.language().CD.as("language")) .from(BOOK) .fetch();
By default, this produces:
INNER JOINif all columns of the foreign key are
LEFT JOINif the foreign key is nullable / optional
This behaviour means that implicit joins do not filter results when placed in clauses that are not meant to filter, such as the SELECT clause or the ORDER BY clause.
Users may prefer to enforce a different behaviour, including:
- Always produce a
LEFT JOIN, e.g. because this was the behaviour before jOOQ 3.14
- Always produce an
INNER JOIN, e.g. because they're migrating off Hibernate / JPA, and depend on Hibernate's implicit joins producing inner joins
This change of behaviour can be achieved with the following setting:
Settings settings = new Settings() .withRenderImplicitJoinType(RenderImplicitJoinType.INNER_JOIN);
Do you have any feedback about this page? We'd love to hear it!