title: Removing items from join table in hibernate when deleting entities
body: <p>I have 2 classes with @ManyToMany relationship</p>
  
  <p>first class: Clip
  second class: Location</p>
  
  <p>the main idea is that a clip can be available in several locations</p>
  
  <p>this is the clip class.</p>
  
  <pre><code>@Entity
  @Table(name = "CLIP")
  public class Clip {
  
      private Long id;
      private List&lt;Location&gt; locations;
  
      @Id @GeneratedValue(strategy=GenerationType.AUTO)
      public Long getId() {
          return id;
      }
      public void setId(Long id) {
          this.id = id;
      }
  
      @ManyToMany( )
             @JoinTable(name="CLIP_LOCATION",joinColumns=@JoinColumn(name="CLIP_ID",nullable=false),inverseJoinColumns=@JoinColumn(name="LOCATION_ID",nullable=false) )
      @ForeignKey(name="FK_CLIP_LOCATION",inverseName="FK_LOCATION_CLIP")
      public List&lt;Location&gt; getLocations() {
          return locations;
      }
      public void setLocations(List&lt;Location&gt; locations) {
          this.locations = locations;
  }
  }
  </code></pre>
  
  <p>this is the Location class</p>
  
  <pre><code>@Entity
  @Table(name = "LOCATION")
  public class Location {
  }
  </code></pre>
  
  <p>this is not a bi-directional relationship</p>
  
  <p>My Question:
  When i remove a location from the user interface , i want the relevant row in the join-table to be removed automatically,</p>
  
  <p>Can i do that?</p>
  
  <p>what annotation should i use?</p>
  
  <p>Note that the Location class and Clip class are used in other relationships too</p>
  
  <p>Thanks
  Maayan
  Am i using the wrong relationship?</p>