Having two unrelated entities:
And the Property:
We are trying to get both Entities, but left join only the Entities that have a specific Property:
So we are interested only in the Entity2 that have a Property named admin. This is just an example, our actual use case is more complicated. This was working fine before hibernate 6, generating the following query:
But with Hibernate 6, another join is added at the end which duplicates the results and breaks the left join:
Join that has no purpose:
Created test cases for both Hibernate 5 and 6: https://github.com/danmercean/hibernate-test-case-left-join-exists |