title: Hibernate Many to Many Relations Set Or List?
body: <p>I have a many to many relationship at my Java beans. When I use <code>List</code> to define my variables as like:</p>
  
  <pre><code>@Entity
  @Table(name="ScD")
  public class Group extends Nameable {
  
      @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, fetch = FetchType.EAGER)
      @JoinColumn(name="b_fk")
      private List&lt;R&gt; r;
      //or
      private Set&lt;R&gt; r;
  </code></pre>
  
  <p>I get that error:</p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0'
  ...
  </code></pre>
  
  <p>When I use <code>Set</code> everything seem to work well.</p>
  
  <p>I want to ask that when using many to many relationships which one to use for logical consept <code>List</code> or <code>Set</code> (because of list may have duplicates and set but what about performance and other issues)?</p>