
jOOQ Masterclass
By :

Next, let's cover more JOIN
s, such as Implicit/Self Joins, NATURAL JOIN
, STRAIGHT JOIN
, Semi/Anti Joins, and LATERAL
Joins. Let's continue with Implicit/Self Joins.
Implicit and Self Joins can be easily expressed in jOOQ via type-safe navigation methods produced by the jOOQ generator in classes that mirror the database tables. Let's dissect this aspect of Implicit Joins.
As an example, an explicit join that fetches a parent table's column from a given child table can be expressed as an Implicit Join. Here is the explicit join:
SELECT o.office_code, e.first_name, e.last_name FROM employee AS e JOIN office AS o ON e.office_code = o.office_code
Here is the less verbose Implicit Join version:
SELECT e.office.office_code, e.first_name, e.last_name FROM employee AS e
If we check the generated Java-based schema, then we notice that the jooq.generated.tables.Employee
class mirroring...