Extra cross-join created when using one-to-one or many-to-one same table entity

We’re having some problems with one-to-one and many-to-one in our hibernate mapping. Currently we use it to extract some columns that are computed in another class, both mapped classes use the same underlying table, but for some reason a cross-join is created towards the same table, resulting in not ideal performance.

For more info, we created this issue: https://hibernate.atlassian.net/browse/HHH-14830

Thanks for creating the JIRA issue. We might be able to fix this for 6.x but this likely won’t be fixed in 5.x as it is pretty hard to do such optimizations on the old query model that 5.x uses.