title: Found shared references to a collection: OneToMany empty collections refering to same PersistentBag
body: <p>I've the following model : An <code>Organization</code> has a <code>List&lt;Contract&gt;</code>, each <code>Contract</code> may have a <code>pricebookId</code> and a collection of <code>PricebookEntry</code>. Multiple <code>Contract</code> entities can have the same <code>pricebookId</code>. The <code>Collection&lt;PricebookEntry&gt;</code> is the result of a <code>@OneToMany</code> association with the <code>pricebookId</code> as <code>JoinColumn</code>.</p>
  
  <p>Here is the postulate: <strong>An organization has 2 contracts and both contracts have no <code>pricebookId</code>.</strong></p>
  
  <p>And here is my problem: During an Hibernate session where this particular Organization is involved, Hibernate throws this exception:
  <code>org.hibernate.HibernateException: Found shared references to a collection: Contract.pricebookEntries</code>.</p>
  
  <p>Indeed, both contracts have their <code>pricebookEntries</code> set to the same <code>PersistentBag</code> (same reference).</p>
  
  <p>How can I fix this ?</p>
  
  <p>Thank you for your help!</p>
  
  <pre><code>@Entity
  public class Organization implements Serializable {
  
    @Id
    private String id;
  
    @Fetch(FetchMode.SUBSELECT)
    @OneToMany(fetch = FetchType.EAGER, mappedBy = "organization")
    private final List&lt;Contract&gt; contracts = new ArrayList&lt;&gt;();
  
  }
  
  
  @Entity
  public class Contract implements Serializable {
  
    @Id
    private String id;
  
    @Column(name = "pricebook_id")
    private String pricebookId;
  
    @JoinColumn(name = "organization_id", referencedColumnName = "id")
    @ManyToOne(fetch = FetchType.LAZY)
    private Organization organization;
  
    @JoinColumn(name="pricebookId", referencedColumnName = "pricebook_id")
    @OneToMany(fetch = FetchType.EAGER)
    @Fetch(FetchMode.SUBSELECT)
    private final Collection&lt;PricebookEntry&gt; pricebookEntries = new ArrayList&lt;&gt;();
  
  }
  
  @Entity
  public class PricebookEntry {
  
    @Id
    private String id;
  
    private String pricebookId;
  
  }
  </code></pre>