Consider three simple entities:
@Entity
public class RootEntity {
@Id
private Long id;
private String name;
}
@Entity
public class UnrelatedEntity {
@Id
private Long id;
private String name;
private String someValue;
}
@Entity
public class OtherEntity {
@Id
private Long id;
}
Execute a query which has two roots and one unrelated join:
entityManager.createQuery("""
select r.name, u.someValue, oe.id
from RootEntity r,
OtherEntity oe
left join UnrelatedEntity u on u.name = r.name
""").getResultList();
With Hibernate 5.x, the query is executed successfully. With Hibernate 6.x, the query fails:
If OtherEntity oe is removed from from clause, the query is executed successfully. This bug is blocking our migration to Hibernate 6 (and consequently Spring Boot 3). Please let me know if you need a full-fledged reproducer project. |