[
https://issues.apache.org/jira/browse/OPENJPA-3098?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18150261#comment-18150261
]
ASF subversion and git services commented on OPENJPA-3098:
----------------------------------------------------------
Commit 58ffa5ae37a5c6b3fc14ce92292e2160cfeee3a3 in openjpa's branch
refs/heads/master from Paulo Cristovão de Araújo Silva Filho
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=58ffa5ae3 ]
Merge pull request #323 from apache/OPENJPA-3098
[OPENJPA-3098] Delete only from the table of the entity in a MySQL and MariaDB
bulk delete
> MySQL and MariaDB: bulk DELETE whose WHERE clause uses a relation also
> deletes the rows of the joined table
> -----------------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-3098
> URL: https://issues.apache.org/jira/browse/OPENJPA-3098
> Project: OpenJPA
> Issue Type: Bug
> Reporter: Richard Zowalla
> Assignee: Richard Zowalla
> Priority: Major
> Fix For: 4.3.0
>
>
> On MySQL and MariaDB a JPQL bulk delete whose WHERE clause navigates a
> relation deletes the matching rows of the joined table too. For
> {code}
> DELETE FROM BulkRangeLine l WHERE l.order.status = :status
> {code}
> OpenJPA issues
> {code}
> DELETE t0, t1 FROM BRG_LINE t0 INNER JOIN BRG_ORDER t1 ON t0.ORDER_ID = t1.ID
> WHERE (t1.STATUS = ?)
> {code}
> MySQL's multi-table DELETE removes the rows from every table in the target
> list, so the orders that match are deleted together with their lines, and
> executeUpdate() returns the sum (3 instead of 2 in the test).
> AbstractMySQLDictionary sets requiresTargetForDelete, and
> DBDictionary.getDeleteTargets() lists all table aliases of the select (since
> OPENJPA-597). Only the table of the entity of the statement must be a target:
> DELETE t0 FROM BRG_LINE t0 INNER JOIN BRG_ORDER t1 ...
> Found by TestBulkSingleTableRange.deleteLinesByOrderStatus (OPENJPA-3094),
> which fails on MySQL 8.4/9.7 and MariaDB 10.11/12.3 in the scheduled
> Databases run: https://github.com/apache/openjpa/actions/runs/45111674759
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)