title: How to delete a row in join table with JPA
body: <p>I have the model below : an article can have some tags and a tag can be on some articles.
  So it is a many-to-many relationship with 3 tables :</p>
  
  <ul>
  <li>ARTICLE</li>
  <li>ARTICLE_TAG</li>
  <li>TAG</li>
  </ul>
  
  <p>When I delete a tag, I want to delete :</p>
  
  <ul>
  <li>the tag in TAG</li>
  <li>all relations between the tag and the articles tagged in ARTICLE_TAG</li>
  </ul>
  
  <p>But I don't want to delete the articles in ARTICLE of course.</p>
  
  <p>How can I do that ?</p>
  
  <p>I try this, but it doesn't work :</p>
  
  <pre><code>Session session = HibernateUtil.getSessionFactory().getCurrentSession();
  for (Article article : tagToDelete.getArticles()) {
      article.getTags().remove(tagToDelete);
  }
  session.delete(tagToDelete);
  </code></pre>
  
  <p>Thanks !</p>
  
  <pre><code>@Entity
  @Table(name="ARTICLE")
  public class Article extends AbstractAuditedEntity {
  
      @Id
      @Column(name="ID", nullable=false)
      private Long id;
  
      @ManyToMany
      @JoinTable(name="ARTICLE_TAG", joinColumns=@JoinColumn(name = "ARTICLE_ID"), inverseJoinColumns=@JoinColumn(name = "TAG_ID"))
      private Set&lt;Tag&gt; tags = new HashSet&lt;&gt;();
  
      public Article() {}
  
      /** Getters &amp; Setters */
  }
  
  @Entity
  @Table(name="TAG")
  public class Tag {
  
      @Id
      @Column(name="ID", nullable=false)
      private Long id;    
  
      @ManyToMany(mappedBy="tags")
      private Set&lt;Article&gt; articles = new HashSet&lt;&gt;();
  
      public Tag() {}
  
      /** Getters &amp; Setters */        
  }
  </code></pre>