title: JPA update list of one to many relationship
body: <p>I have a Question entity with a list of another entity called Alternatives like this:</p>
  
  <pre><code>public class Question {
      @OneToMany(fetch = FetchType.LAZY, mappedBy = "question", cascade = CascadeType.ALL)
      @JsonManagedReference
      private List&lt;Alternative&gt; alternativeList;
  }
  
  public class Alternative implements Serializable {
      @ManyToOne(fetch = FetchType.LAZY)
      @JoinColumn(name = "questionId", nullable = false)
      @JsonBackReference
      private Question question;
  
  }
  </code></pre>
  
  <p>Then I wanted to update an exiting Question entry with a new set of Alternative list. For this I'm calling merge method of my JpaDao element with the new Question object:</p>
  
  <pre><code>@Repository
  public class JpaQuestionDao implements QuestionDao {
      @PersistenceContext
      private EntityManager em;
  
      @Transactional
      public Question update(Question question) {
          return em.merge(question);
      }
  }
  </code></pre>
  
  <p>However, this is in fact merging the two lists: the one already in database and the new provided one. I haven't had any problem with such method when I have non-list objects, that's why I kept using merge method.</p>
  
  <p>Is there an alternative method to not merge but only update a list?</p>