JPA/Hibernate, Delete on ManyToMany doesn't delete join table records <p>this has been asked a number of other times, but I can't figure out an answer in my case. </p> <p>I have this class <a href="http://tinyurl.com/nrhbnna" rel="nofollow">http://tinyurl.com/nrhbnna</a>, having a ManyToMany relationship to OntologyEntry. Here it is a fragment:</p> <pre><code>@MappedSuperclass public abstract class FreeTextTerm extends Identifiable { ... @ManyToMany( targetEntity = OntologyEntry.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH } ) @JoinTable ( joinColumns = @JoinColumn ( name = "owner_id" ), inverseJoinColumns = @JoinColumn ( name = "oe_id" ) ) @SuppressWarnings ( "unchecked" ) public &lt;OE extends OntologyEntry&gt; Set&lt;OE&gt; getOntologyTerms () ... } </code></pre> <p>I don't have the symmetric side OntologyEntry.freeTextTerms(), cause I don't need it and they don't work well with polymorphism.</p> <p>Now, when I delete records from subclasses in HQL (eg, from ExperimentalPropertyValue, <a href="http://tinyurl.com/mydgnwr" rel="nofollow">http://tinyurl.com/mydgnwr</a>, or Unit, <a href="http://tinyurl.com/lu28sfu" rel="nofollow">http://tinyurl.com/lu28sfu</a>), Hibernate completely ignores records in the respective join tables (eg, it ignores unit_onto_entry, when I delete Unit instances, verified via logs), resulting in foreign key violations, if the current owner has such links.</p> <p>I already know this happens when you attempt to delete from the non-owner side of a many-to-many relation, but that's not the case here. Moreover, I don't think CascadeType.DELETE would help here, cause I do not want to delete children (ie, ontology entries), just the links to them.</p> <p>So, is Hibernate as crap as to ignore such links? (After years of experience, I really hate Hibernate). Do I have to use @PreRemove, as explained in <a href="http://tinyurl.com/kgpk92a" rel="nofollow">http://tinyurl.com/kgpk92a</a>, or is there a cleaner solution?</p> <p>Thanks in advance.</p>