Nemanja Jovanovic (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNmM3YjhlY2Y3...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16721?atlOrigin=eyJpIjoiNmM3Yj...
) HHH-16721 (
https://hibernate.atlassian.net/browse/HHH-16721?atlOrigin=eyJpIjoiNmM3Yj...
) HQL with subquery with entity path at least two deep produces wrong SQL (
https://hibernate.atlassian.net/browse/HHH-16721?atlOrigin=eyJpIjoiNmM3Yj...
)
Issue Type: Bug Affects Versions: 6.2.2, 6.2.3 Assignee: Unassigned Created: 30/May/2023
08:46 AM Environment: If we have for example these entities:
Priority: Major Reporter: Nemanja Jovanovic (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
If we have for example these entities:
@Entity
class A implements Serializable {
private static final long serialVersionUID = -5412503864464287451L;
@Id @GeneratedValue long id;
@ManyToOne B b;
}
@Entity
class B implements Serializable {
private static final long serialVersionUID = 1L;
@Id @GeneratedValue long id;
@ManyToOne C c;
}
@Entity
class C implements Serializable {
private static final long serialVersionUID = 1L;
@Id @GeneratedValue long id;
}
HQL like this:
select a.id from A a where exists (select b.id from B b where a.b.c.id = 5) will produce
SQL:
select a1_0.id from A a1_0 where exists(select b1_0.id from B b1_0,B b2_0 where
b2_0.c_id=5)
This is obviously wrong as b2_0 should be in correlation with a1_0 . Exists is not a
factor here as this does not work with in either. Attached test contains more examples,
see console output.
(
https://hibernate.atlassian.net/browse/HHH-16721#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16721#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#100225- sha1:d82e018 )