title: Spring MVC 3 Hibernate JPA Annotations onetomany and manytoone relationships cascade delete
body: <p>I have the following entities and I have to delete the ServiceRegistration and ServiceChannels entries when I delete the ServiceRegistration record. But now, if I delete a record in serviceregistration, it delete the records in channel which is metadata table.</p>
  
  <p>ServiceRegistration.Java</p>
  
  <pre><code>@OneToMany(cascade=CascadeType.ALL,fetch = FetchType.EAGER)
  @JoinTable(name = "ServiceChannel", joinColumns = {
   @JoinColumn(name="serviceid", unique = true) 
   },
   inverseJoinColumns = {
   @JoinColumn(name="channelid")
   }
   )
  
   private List&lt;Channels&gt; channelsInvolved;
  
       public List&lt;Channels&gt; getChannelsInvolved() {
      return channelsInvolved;
    }
  
  public void setChannelsInvolved(List&lt;Channels&gt; channelsInvolved) {
      this.channelsInvolved = channelsInvolved;
    }
  </code></pre>
  
  <p>ServiceChannels.java</p>
  
  <pre><code>@Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column private int servicechannelid;    
  
  @ManyToOne
  @JoinColumn(name = "serviceid")
  private ServiceRegistration serviceRegistration;
  
  @ManyToOne
  @JoinColumn(name = "channelid")
  private Channels channels;
  </code></pre>
  
  <p>Channels.java >> contains meta-data</p>
  
  <pre><code>@Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column private int channelid;
  @Column private String channelname;
  
  @Override
      public boolean equals(final Object obj) {
          if (obj instanceof Channels) {
              final Channels other = (Channels) obj;
              if (other.getChannelid() == getChannelid()) {
                  return true;
              }
          } 
          return false;
      }
  </code></pre>
  
  <p>Please help me how to do cascade delete in this entity relation.</p>