JPA delete query with multiple subqueries fails due to incorrect alias being generated
Issue
In a query like:
DELETE FROM Panel panelEntity WHERE
panelEntity.posterCampaignId = osterCampaignId
AND panelEntity.framePackagePrintId IS NULL
AND panelEntity.clientId IN ( SELECT trtPanel.clientId FROM TrtPanel trtPanel )
AND panelEntity.deltaStamp NOT IN SELECT trtPanel.deltaStamp FROM TrtPanel trtPanel )
The generated SQL looks like:
delete from PRD_PANEL where
PPA_POSTER_CAMPAIGN_ID=?
and (PPA_FRAME_PACKAGE_ID_PRINT is null)
and (PPA_CLIENT_ID in (select trtpanel1_.TTP_CLIENT_ID from TEMP_TRT_PANEL trtpanel1_))
and (panel0_.PPA_DELTA_STAMP not in (select trtpanel2_.TTP_DELTA_STAMP from TEMP_TRT_PANEL trtpanel2_))
The panel0_ alias is stripped from the from element (as it should be), but is remaining on the 2nd where clause.
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.0
- 6.1
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
