Bogdan Ilchyshyn (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNDQxNmI1MDk5...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-17028?atlOrigin=eyJpIjoiNDQxNm...
) HHH-17028 (
https://hibernate.atlassian.net/browse/HHH-17028?atlOrigin=eyJpIjoiNDQxNm...
) Unrelated left join fails when query has multiple roots (
https://hibernate.atlassian.net/browse/HHH-17028?atlOrigin=eyJpIjoiNDQxNm...
)
Issue Type: Bug Affects Versions: 6.2.7 Assignee: Unassigned Created: 02/Aug/2023 21:05 PM
Priority: Major Reporter: Bogdan Ilchyshyn (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
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:
java.lang.IllegalArgumentException: org.hibernate.query.SemanticException:
SqmQualifiedJoin predicate referred to SqmRoot [com.example.demo.RootEntity(r)] other than
the join's root [com.example.demo.UnrelatedEntity(u)]
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.
(
https://hibernate.atlassian.net/browse/HHH-17028#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-17028#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100233- sha1:3ea1a2a )