The bug was introduced by HHH-9305.
Tree entities with OneToOne association:
person <> address <> country
We are using JPA criteria that's why we cannot use fetch in the where clause. So we are doing the following:
After changes it reuses the first fetch and query (during parsing) is become as this:
Because it cannot found parent for country fetch it throws an error:
org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list
Since I cannot imagine a case where I need to do join twice in OneToOne associations except for fetching I think it's ok to reuse join here but for this case it should be the second join (with fetch option).
I have found a good workaround.
This query can be converted to JPA criteria query and will do exactly the same thing without any errors.