This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 298193 - Create UpdateAll/DeleteAll queries that include a subquery without reference to outer select
Summary: Create UpdateAll/DeleteAll queries that include a subquery without reference ...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-18 10:59 EST by Tom Ware CLA
Modified: 2022-06-09 10:28 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Ware CLA 2009-12-18 10:59:23 EST
Currently on most databases, UpdateAll/DeleteAll queries use a query that includes a subselect to execute for objects that have multiple tables.

The subselect references a table in the outer select.  In most databases this is allowed, but on MySQL and Symfoware, this is disallowed.  It should be possible to create this subselect without the reference to the outer query.

To recreate, run a DeleteAll query for Employee on MySQL

Fixing this issue will allow more queries to run without temp tables on MySQL and allow most DeleteAll/UpdateAll queries for multi-table objects to run on Symfoware.
Comment 1 Dies Koper CLA 2010-02-19 22:00:42 EST
CC'ing myself.

When there is only one PK required to link the tables, the query could be rewritten as follows:

DELETE FROM SALARY WHERE ID = (SELECT t0.ID FROM EMPLOYEE t0 WHERE (t0.ID > 0))

I haven't been able to come up with something similar in the case of multi-column PKs.
Another solution might be to create a stored procedure on the fly to do this using multiple cursors.
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:28:28 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink