JPA delete query with multiple subqueries fails due to incorrect alias being generated

Solution Verified - Updated -

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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content