Adrian Cox (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=60e7210...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNmEwZGMxZjkx...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16002?atlOrigin=eyJpIjoiNmEwZG...
) HHH-16002 (
https://hibernate.atlassian.net/browse/HHH-16002?atlOrigin=eyJpIjoiNmEwZG...
) JPQL queries failing through composite key (
https://hibernate.atlassian.net/browse/HHH-16002?atlOrigin=eyJpIjoiNmEwZG...
)
Issue Type: Bug Affects Versions: 5.4.0, 5.6.14 Assignee: Unassigned Created: 08/Jan/2023
08:49 AM Environment: Hibernate 5.6.14, Java 11, Windows 10 Priority: Major Reporter:
Adrian Cox (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=60e7210...
)
Hibernate 5.6 generates incorrect SQL for JPQL queries involving an `@IdClass` mapping.
The test case is here:
https://github.com/AdrianAtHumboldt/hibernate-test-case-idclass (
https://github.com/AdrianAtHumboldt/hibernate-test-case-idclass )
The tests pass with Hibernate 5.3.27, but fail for 5.4.0 through to 5.6.14.
There are two likely related failures - in the first failure the expected parameter type
has changed for a query. In the query `select x from EntityX x where x.link.attribute = ?1
and x.link.s = ?2` Parameter type 2 is now expected to be long, which is the primary key
of S.
In the second failure the wrong SQL is generated for the query `select x from EntityX x
where x.link.attribute = ?1 and x.link.s.id = ?2`. The final line is a test on x.id
instead of on x.link.s.id.
select
entityx0_.id as id1_2_,
entityx0_.link_entitys_id as link_ent2_2_,
entityx0_.link_entityv_id as link_ent3_2_
from
EntityX entityx0_ cross
join
Link link1_
where
entityx0_.link_entitys_id=link1_.entitys_id
and entityx0_.link_entityv_id=link1_.entityv_id
and link1_. attribute =?
and entityx0_.id=?
(
https://hibernate.atlassian.net/browse/HHH-16002#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16002#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#100213- sha1:f908df2 )