[
https://issues.apache.org/jira/browse/OPENJPA-3036?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Richard Zowalla updated OPENJPA-3036:
-------------------------------------
Fix Version/s: 4.2.0
> MySQL: bulk UPDATE with a subquery on the same table
> ----------------------------------------------------
>
> Key: OPENJPA-3036
> URL: https://issues.apache.org/jira/browse/OPENJPA-3036
> Project: OpenJPA
> Issue Type: Sub-task
> Reporter: Richard Zowalla
> Priority: Major
> Fix For: 4.2.0
>
>
> MySQL does not allow the updated table in a subquery of the same statement:
> {noformat}You can't specify target table 't0' for update in FROM clause
> {prepstmnt UPDATE PRODUCT_TABLE t0 INNER JOIN PRODUCT_DETAILS t2 ON t0.ID =
> t2.ID SET t0.QUANTITY = (t0.QUANTITY * ?) WHERE (EXISTS (SELECT t1.ID FROM
> PRODUCT_TABLE t1 WHERE (t0.ID = ?)))} [code=1093]{noformat}
> The usual way around it is to wrap the subquery in a derived table.
> Failing test: {{Client.subquery}}.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)