title: Hibernate : one to many mapping for multiple entities
body: <p>Suppose we have four entities A, B, C, and Document.</p>
  
  <pre><code>A -&gt; Many Documents (one-to-many)
  B -&gt; Many Documents (one-to-many)
  C -&gt; Many Documents (one-to-many)
  </code></pre>
  
  <p>A, B, C can have many documents.
  In traditional one-to-many mapping style we'll have Document table like below:</p>
  
  <h2>Document Table:</h2>
  
  <h2>|doc_id | doc_field_1 | doc_field_2 | A_id | B_id | C_id |</h2>
  
  <p>if I add A entity's documents then, for these documants B_id and C_id would be  null.
  same for B's and C's document.
  hope problem is clear.</p>
  
  <p>I want Document entity to keep only one id and entity class where I can query Document table in hibernate way.</p>
  
  <p>Or any other way to solve the problem.</p>