rzo1 opened a new pull request, #327:
URL: https://github.com/apache/openjpa/pull/327

   https://issues.apache.org/jira/browse/OPENJPA-3099
   
   `TYPE()` of a single-valued path did not join the related entity, so the 
discriminator was read from an unjoined alias:
   
   ```
   DELETE FROM BulkRangeLine l WHERE TYPE(l.order) = BulkRangeRushOrder
   -- before (deletes every line)
   DELETE FROM BRG_LINE WHERE ID IN (SELECT DISTINCT t1.ID FROM BRG_ORDER t0, 
BRG_LINE t1 WHERE (t0.ORDER_TYPE = 'BulkRangeRushOrder'))
   -- after
   DELETE FROM BRG_LINE WHERE ID IN (SELECT DISTINCT t0.ID FROM BRG_LINE t0 
INNER JOIN BRG_ORDER t1 ON t0.ORDER_ID = t1.ID WHERE (t1.ORDER_TYPE = 
'BulkRangeRushOrder'))
   ```
   
   - `Type`: initializes the path with `JOIN_REL`; `load` returns the base 
class for its own discriminator value and null for a missing relation.
   - `TypeLit`: selects the primary key of the literal's entity only when the 
literal is projected, so a literal in a condition adds no table (this also 
caused the extra `t0.ID` that broke `COUNT`).
   - `NotEqualTypeExpression`: `TYPE(x) <> X` was written as `=` outside a 
table-per-class hierarchy.
   - `TestTypeOfPath`: delete, update, count and select by `TYPE()` of a path, 
`IN`/`NOT IN`, parameters, a nullable relation, a JOINED hierarchy with a 
discriminator, subqueries and `CASE WHEN`; all fail on master.
   - `TestBulkUpdate`: the parameterized helper had `@Test`, which JUnit cannot 
resolve.
   
   Still broken on master and not changed here: `TYPE()` comparisons on a 
JOINED hierarchy without a discriminator column, `TYPE(x) IN (A, B)` on a 
JOINED hierarchy, and the simple `CASE TYPE(x) WHEN` form.
   
   Builds on #323 (OPENJPA-3098), which makes the MySQL and MariaDB bulk delete 
name only the table of the entity.
   


-- 
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]

Reply via email to