We first run to this issue in autumn 2014 and while it can be worked over with subqueries we decided to stay on EclipseLink and I forgot it. Today I tested it again with 5.0.6.Final – I did it as a part of one heated discussion about how easy it is to swap JPA providers and both parties agreed there is nothing in JPA 2.1 specification that should stop this from working. I tested it with H2 and from JPQL: delete from Dog d where d.breed.name = 'collie' It rendered this SQL: DELETE FROM DOG CROSS[*] JOIN BREED BREED1_ WHERE NAME='collie' (not to mention that name field is both on Dog and Breed and is not qualified in the result) Both entities are as plain as possible, relation looks like this: @ManyToOne @JoinColumn(name = "breed_id") private Breed breed; Test case can be run from shell like this:
Fails during the test run. JPA 2.1 specifiction in §4.10 describes bulk updates and refers to where_clause described in §4.5. For selects it works as expected. |