Krzysiek Bieroń (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=6308fd5...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZmViZGZiNmE3...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-15467?atlOrigin=eyJpIjoiZmViZG...
) HHH-15467 (
https://hibernate.atlassian.net/browse/HHH-15467?atlOrigin=eyJpIjoiZmViZG...
) Redundant join in generated statement for JPQL with simple equality condition (
https://hibernate.atlassian.net/browse/HHH-15467?atlOrigin=eyJpIjoiZmViZG...
)
Issue Type: Bug Affects Versions: 5.6.10 Assignee: Unassigned Created: 26/Aug/2022 10:44
AM Priority: Major Reporter: Krzysiek Bieroń (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=6308fd5...
)
Entity class with a field annotated with @OneToMany and @JoinTable causes simple id = ?
predicate to be transformed into complex (id) in select .. join .... This produces very
slow query, not to mention additional db locks.
*********
Test case
*********
https://github.com/el-dot/hibernate-test-case-redundant-join-in-statement (
https://github.com/el-dot/hibernate-test-case-redundant-join-in-statement )
------------------
Expected statement
------------------
update Parent set someField=? where id =?`
----------------
Actual statement
----------------
update Parent set someField=? where (id) in (select jpaunittes0_.id as id from Parent
jpaunittes0_ left outer join parent_child jpaunittes0_1_ on
jpaunittes0_.id=jpaunittes0_1_.id where jpaunittes0_.id=?)
(
https://hibernate.atlassian.net/browse/HHH-15467#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15467#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#100206- sha1:4ed3dc7 )