Richard Zowalla created OPENJPA-3036:
----------------------------------------
Summary: 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
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)