title: Multiple foreign key mapping
body: <p>I am trying to learn Hibernate and i can't solve a design problem. 
  I have Head and Group Classes. I have generated two tables listed below using hibernate. </p>
  
  <pre><code>Table-Head
  id, int4, primary key
  name, varchar 50
  description, varchar 250
  
  Table-Group 
  id, int4, primary key
  name, varchar 25
  description, varchar 250
  </code></pre>
  
  <p>I just want to ask how can i generate HeadAndGroup table which is listed below? I have tried to write HeadAndGroup as separate class but i can't handle it.</p>
  
  <pre><code>Table HeadAndGroup (Many to Many)
  id , int4, primary key
  head_id , int4, foreign key -&gt; head table
  group_id , int4, foreign key -&gt; group table
  
  
  **head_id, group_id pair will be unique
  </code></pre>