title: never updating record in left outer join many to many relation spring data jpa
body: <p>I have entity relation as </p>
  
  <p>@Entity Foo </p>
  
  <pre><code>//showing only mapping
  @ManyToMany(cascade = {CascadeType.MERGE})
  @JoinTable(name = "foo_bars",
             joinColumns = @JoinColumn(name = "foos_id"),
             inverseJoinColumns = @JoinColumn(name = "bars_id"))
      private List&lt;Bar&gt; bars;
  </code></pre>
  
  <p>and @Entity Bar is </p>
  
  <pre><code>//showing only mapping
  @ManyToMany(mappedBy = "bars", cascade = {CascadeType.MERGE})   
  private List&lt;Foo&gt; foos;
  </code></pre>
  
  <p>for saving one Foo with one/many Bars I have a service method</p>
  
  <pre><code>    public void saveBar(Foo foo) {
          logger.info("calling saveBar method");
          barRepository.save(foo.getBars());      
      }
  
  
      public void save(Foo foo) {     
          fooRepository.save(obj);
          saveBar(obj);
      }
  </code></pre>
  
  <p>data is saved successfully, but things go complicated when I need to update the Foo and add/remove Bars, I have service method for update </p>
  
  <pre><code>public void update(Foo foo) {
      fooRepository.update(foo.getId(), foo.getTitle());
      saveBar(foo);
  }
  </code></pre>
  
  <p>the update method does update Foo but doesn't update related bars, the foo contains the same bars which were added as it was newly created.</p>
  
  <p>Any mistakes I'm making there?</p>