title: How to define a ElementCollection of an Embedded type which contains @OneToMany relation in JPA 2.0
body: <blockquote>
  <p>Hi All,</p>
  <p>I am new to JPA. I am facing an issue in below scenario;</p>
  <p>I have an embeddable class ContactInformation as mention below;</p>
  </blockquote>
  <pre><code>@Embeddable public class ContactInformation {
      @OneToMany
      private Set&lt;Phone&gt; phoneList;
      @Embedded
      private Address address;
  ......
  }
  </code></pre>
  <blockquote>
  <blockquote>
  <p>I have another entity class Employee as shown below;</p>
  </blockquote>
  </blockquote>
  <pre><code>   @Entity
  
     @IdClass(EmployeeId.class)
  
     public class Employee implements Serializable {
  
  
      private static final long serialVersionUID = 1L;
  
     @Id
     private String id;
  
     @Id
     private String name;
  
     @ElementCollection
     @CollectionTable(name = &quot;employee_interests&quot;) 
     private Set&lt;String&gt; interests;
  //COMPILE TIME ERROR LINE BELOW
     @ElementCollection
     private Set&lt;ContractInformation&gt; info;
  
      ...
      }
  </code></pre>
  <blockquote>
  <blockquote>
  <p>In above case, I am getting compile time error in above mention line as <strong>&quot;Mapping contains an embeddable &quot;main.ContractInformation&quot; with a prohibited mapping &quot;phoneList&quot;, embeddables in element collections may only contain many-to-one or one-to-one mappings which must be on the &quot;owning&quot; side of the relationship and must not use join table&quot;</strong></p>
  </blockquote>
  </blockquote>
  <p>Can you please help me how we can correct this?</p>
  <p>Thanks for your help in advance !!</p>