[hibernate-dev] Why does implicit join translate to inner join?
andrea at hibernate.org
Thu Feb 22 04:59:45 EST 2018
I think it is based on JPA 2.1 spec, 4.4.4 Path Expressions , "Path
expression navigability is composed using “inner join” semantics."
On 22 February 2018 at 08:09, Lukas Eder <lukas.eder at gmail.com> wrote:
> Vlad Mihalcea  was so kind to point me to this mailing list with my
> question about implicit joins. The user guide  states that:
> "Implicit joins are always treated as inner joins."
> To me, this seems wrong, semantically, if implicit joins follow optional
> (nullable) foreign key relationships. Let's assume that customers have
> optional addresses. When we write
> SELECT c.firstName, c.lastName, c.address.city.country.code
> FROM customer c
> The resulting query will INNER JOIN the customer / address / city / country
> tables, filtering out customers with no address, or addresses with no
> cities, or cities with no countries (let's ignore the modelling aspect). In
> fact, I got a CROSS JOIN with join predicate in the WHERE clause, but that
> doesn't really change anything. Hence the SELECT clause applies a filter,
> which is rather surprising. To me, this seems simply wrong just like it
> would be wrong for Stream.map() to apply any filters.
> However, I'm sure there must have been good reasons to default to this
> behaviour, even in the presence of optional foreign keys.
> Does anyone know what those reasons are?
> : https://twitter.com/vlad_mihalcea/status/965927462684196864
> : http://docs.jboss.org/hibernate/orm/5.2/userguide/
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
More information about the hibernate-dev