Emond Papegaaij (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiOTVjYWYzN2Ew...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16642?atlOrigin=eyJpIjoiOTVjYW...
) HHH-16642 (
https://hibernate.atlassian.net/browse/HHH-16642?atlOrigin=eyJpIjoiOTVjYW...
) Treated join in subquery in criteria update results in invalid SQL (
https://hibernate.atlassian.net/browse/HHH-16642?atlOrigin=eyJpIjoiOTVjYW...
)
Issue Type: Bug Affects Versions: 6.2.3 Assignee: Unassigned Components: hibernate-core
Created: 19/May/2023 06:24 AM Priority: Major Reporter: Emond Papegaaij (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
When performing an update via a CriteriaUpdate with a subselect and a treated join in the
where clause, invalid SQL is generated. The DTYPE restriction is lifted from the subselect
to the outer update query, where the from-alias is undefined. The attached testcase shows
this problem and results in the following query:
update
MyEntity1
set
ref2= null
where
id in (( select
m2_0.id
from
MyEntity1 m2_0
join
( select
*
from
MyEntity2 t
where
t.DTYPE= 'MySubEntity2' ) r2_0
on r2_0.id=m2_0.ref2
where
r2_0.ref3=?
and r2_0.DTYPE= 'MySubEntity2' ))
and r2_0.DTYPE= 'MySubEntity2'
(
https://hibernate.atlassian.net/browse/HHH-16642#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16642#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:9dd72a2 )