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'
|