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 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=?
|