rzo1 opened a new pull request, #323: URL: https://github.com/apache/openjpa/pull/323
https://issues.apache.org/jira/browse/OPENJPA-3098 On MySQL and MariaDB a JPQL bulk delete whose WHERE clause uses a relation deleted the joined rows as well: ``` DELETE FROM BulkRangeLine l WHERE l.order.status = :status -- before DELETE t0, t1 FROM BRG_LINE t0 INNER JOIN BRG_ORDER t1 ON t0.ORDER_ID = t1.ID WHERE (t1.STATUS = ?) -- after DELETE t0 FROM BRG_LINE t0 INNER JOIN BRG_ORDER t1 ON t0.ORDER_ID = t1.ID WHERE (t1.STATUS = ?) ``` `TestBulkSingleTableRange.deleteLinesByOrderStatus` (#317) found it in the scheduled Databases run. The code dates from OPENJPA-597, so 4.2.0 is affected. - `DBDictionary.getDeleteTargets(ClassMapping, Select)`: the alias of the table whose identifier the select reads; the old `getDeleteTargets(Select)` remains the fallback. - The fallback on the primary key subquery now names the table as target (it emitted `DELETE t0 FROM <table>`) and wraps the subquery in a derived table where `allowsBulkTargetInSubselect` is false (MySQL error 1093). - Tests: the existing test also checks that the orders survive; new cases for a join with a subquery and for the two alias settings of the dictionary. Only `AbstractMySQLDictionary` sets `requiresTargetForDelete`, so the SQL of the other databases does not change. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
