Hey again,
I implemented the approach that I proposed in the issue and a test in
https://github.com/hibernate/hibernate-orm/pull/1561
It detects left joins with join tables that use the target table alias.
The join table is replaced with a subquery and the WITH clause is moved
to the join of the subquery.
Any comments?
Regards,
Christian