title: On Delete Cascade Hibernate ManyToMany
body: <p>I want UserAcounts to be able to have many UserGroups.And All Groups can have many Users.And there is a join table.I want the releation between useraccount and usergroup in join table to be deleted when a useraccount is deleted.</p>
  
  <p>Actually i want to use "on delete cascade".In ManyToMany relation I coulndn't run it unfortunately.I've tried so much thing but no solution I've found.</p>
  
  <p>Note:I just want Relation to be deleted with on delete cascade</p>
  
  <p>is it possible is there a way to do that?</p>
  
  <p>Here is my hibernate classes</p>
  
  <pre><code>@SuppressWarnings("serial")
  @Entity
  @Table(name = "USER_ACCOUNT")
  public class UserAccount implements Serializable {
  
  @Id
  @Column(name = "ID")
  @GeneratedValue
  private Long id;
  
  @Column(name = "NAME")
  private String name;
  
  @Column(name = "SURNAME")
  private String surname;
  
  @Column(name = "EMAIL")
  private String email;
  
  @Column(name = "USER_NAME")
  private String username;
  
  @Column(name = "PASSWORD")
  private String password;
  
  @Column(name = "ENABLED")
  @Type(type = "yes_no")
  private boolean enabled;
  
  @Column(name = "ACCOUNT_NON_EXPIRED")
  @Type(type = "yes_no")
  private boolean accountNonExpired;
  
  @Column(name = "CREDENTIALS_NON_EXPIRED")
  @Type(type = "yes_no")
  private boolean credentialsNonExpired;
  
  @Column(name = "ACCOUNT_NON_LOCKED")
  @Type(type = "yes_no")
  private boolean accountNonLocked;
  
  @Column(name = "ENTRY_DATE")
  private Date entryDate;
  
  @Column(name = "UPDATE_DATE")
  private Date updateDate;
  
  @Column(name = "LAST_LOGIN_DATE")
  private Date lastLoginDate;
  
  @Column(name = "LOCAL")
  private String local;
  
  @ManyToMany(cascade = CascadeType.ALL,fetch=FetchType.EAGER)
  @JoinTable(name = "ACCOUNT_GROUP", joinColumns = { @JoinColumn(name = "ID") }, inverseJoinColumns = { @JoinColumn(name = "GROUP_ID") })
  private List&lt;UserGroup&gt; userGroups;
  
  
  
  
  
  
  
  
  @SuppressWarnings("serial")
  @Entity
  @Table(name = "USER_GROUP")
  public class UserGroup implements Serializable {
  
  @Id
  @Column(name = "GROUP_ID")
  @GeneratedValue
  private Long id;
  
  @Column(name = "GROUP_NAME")
  private String name;
  
  @Column(name = "GROUP_DESCRIPTION")
  private String description;
  </code></pre>
  
  <p>I've researched too much but i couldn't run it.</p>