We have this relationship:
public class RuleProviderEntity implements Serializable
{
...
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@OrderColumn(name = RuleEntity.RULE_SEQUENCE)
private List<RuleEntity> rules;
}
This alone creates a join table with 2 keys and the RULE_SEQUENCE column. So far good and works for SELECTs.
Now there's a JQL query
DELETE FROM RuleProviderEntity WHERE ...
But this fails to cascade deleting the RuleEntity
rows. It just deletes the RuleProviderEntity
and leaves the RuleEntity
intact.
Is this supposed to work in JPA 2 and it's a Hibernate bug, or am I missing something in the config?
I know I could add @JoinTable
but it would only override the defaults.
Also orphanRemoval
seems not necessary here.
Maybe I could do a workaround with @PreRemove
but not sure how.