title: Hibernate: on delete cascade action for join table
body: <p>I have a many-to-many relation between two entities 'menu_groups' and 'pages' as follows</p>
  
  <pre><code>    public class MenuGroup {
          @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.MERGE)
          @JoinTable(name = "menu_group_pages",schema="live",    
                    joinColumns=@JoinColumn(name="menu_groups_id"),
                    inverseJoinColumns=@JoinColumn(name="pages_id"))
          private Set&lt;Page&gt; pages = new HashSet&lt;Page&gt;();
      }
  
      public class Page {
         @ManyToMany(fetch = FetchType.EAGER, mappedBy="pages", 
                     cascade={CascadeType.MERGE})
  
         private Set&lt;MenuGroup&gt; menuGroups = new HashSet&lt;MenuGroup&gt;();
      }
  </code></pre>
  
  <p>As you could see there is a join table which has two fk: menu_groups_id and pages_id. Now I want to add on delete cascade action for fk 'pages_id' in this join table. For a normal table, the statement is something like </p>
  
  <pre><code>    @OnDelete(action=OnDeleteAction.CASCADE)
  </code></pre>
  
  <p>How could I do this for a join table? Thanks</p>