Bogdan Ilchyshyn (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZTdmNmRiYjNi...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-17028?atlOrigin=eyJpIjoiZTdmNm...
) HHH-17028 (
https://hibernate.atlassian.net/browse/HHH-17028?atlOrigin=eyJpIjoiZTdmNm...
) Unrelated left join fails when query has multiple roots (
https://hibernate.atlassian.net/browse/HHH-17028?atlOrigin=eyJpIjoiZTdmNm...
)
Change By: Bogdan Ilchyshyn (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
Consider three simple entities:
{code:java}@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;
}{code}
Execute a query which has two roots and one unrelated join:
{code:java}entityManager.createQuery("""
select r.name, u.someValue, oe.id
from RootEntity r,
OtherEntity oe
left join UnrelatedEntity u on u.name = r.name
""").getResultList();{code}
With Hibernate 5.x, the query is executed successfully.
With Hibernate 6.x, the query fails:
{noformat}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)]{noformat}
If {{OtherEntity oe}} is removed from {{from}} clause, the query is executed
successfully.
Please see reproducer:
[^hibernate-orm-6-HHH-17028.zip]
This bug is blocking our migration to Hibernate 6 (and consequently to 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 )