title: JPA Entities with JoinColumn of two columns
body: <p>I have this escenario... I have three 4 entities {orderItem, suppliers, supplier, prices}, and they are related like:</p>
  
  <pre><code>OrderItem 1-&gt;* suppliers (some one item can have many supplier prices)
  
  Suppliers 1-&gt;1 supplier
  
  Suppliers 1-&gt;1 itemPrices
  </code></pre>
  
  <p>and it's properties</p>
  
  <pre><code>OrderItem {orderId, partId, quantity, suppliers}
  
  Suppliers {orderId, partId, Supplier}
  </code></pre>
  
  <p>And there my proble goes... </p>
  
  <p>What would be the best way to embed the Suppliers entity to the OrderItem Entity, please forget about the relation between suppliers with supplier and itemprice this is already done using join columns.</p>
  
  <p>Will something like </p>
  
  <pre><code>@JoinTable(name = "Suppliers", joinColumns = { @JoinColumn(name = "orderid", referencedColumnName = "orderid") }, inverseJoinColumns = { @JoinColumn(name = "partid", referencedColumnName = "partid") })
  </code></pre>
  
  <p>will work?</p>
  
  <p>or: </p>
  
  <pre><code>@OneToMany(mappedBy="orderid, partid")
  private List&lt;Suppliers&gt; suppliers;
  </code></pre>
  
  <p>for example..</p>