title: JPA: Non unique "OneToMany" collection
body: <p>I want to map a "collection". A collection is a group of items that the user can group as they wish.</p>
  
  <pre><code>@Entity 
  class Item {
    Long id;
    String name
  }
  
  @Entity 
  class MyCollection {
    Long id;
    String name;
  
    @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
    Set&lt;Item&gt; items;
  }
  </code></pre>
  
  <p>The user should be able to put <code>Item</code> name "foo" into `MyCollection' name "bar" and into 'MyCollection' name "bar2"</p>
  
  <p>The join table that JPA/Hibernate is creating for me, <code>MyCollection_Item</code> has has 4 indexes, the PK (<code>MyCollection_id, Item_id</code>), a unique index (<code>Item_id</code>), and the 2 foreign keys.</p>
  
  <p>I do not want it to create the unique index on <code>Item_id</code>. This prevents me from having:</p>
  
  <p><code>MyCollection_id, Item_Id</code></p>
  
  <p><code>1, 1</code></p>
  
  <p><code>1, 2</code></p>
  
  <p><code>2, 1</code></p>
  
  <p>I am sure this type of mapping must be possible? Any help would be greatly appreciated.</p>