3 ms·
ORMs like Hibernate / jOOQ work around this by providing a convenient "dot notation" to navigate a foreign key path. This is particularly useful when keys are c
by lukaseder 8y ago
ORMs like Hibernate / jOOQ work around this by providing a convenient "dot notation" to navigate a foreign key path. This is particularly useful when keys are composite. See for example: https://blog.jooq.org/2018/02/20/type-safe-implicit-join-through-path-navigation-in-jooq-3-11 https://blog.jooq.org/2018/02/20/type-safe-implicit-join-thr...
Indeed, this should be available in the SQL language as well. I can't think of a performance problem, having implemented this in jOOQ. There's always a very obvious mapping between the notation and inner/left joins, which are reusable for common paths and subpaths.
At least for navigating to-one relationships. To-many relationships raise more questions.
Some RDBMS support a T1 JOIN T2 ON KEY syntax, which is nice as well, but the path notation is much more powerful:
SELECT
c.first_name,
c.last_name
c.address.street,
c.address.zip,
c.address.city
FROM customer c
Instead of
SELECT
c.first_name,
c.last_name
a.street,
a.zip,
a.city
FROM customer c
JOIN address a USING (address_id)