title: How to join three tables using a single table in hibernate?
body: <p>I have three tables <code>A</code>, <code>B</code> and <code>C</code> and a mapping table <code>A_B_C</code> which has foreign keys to all the three tables and some other attributes (let's say <code>X</code>,<code>Y</code>).  Now, I want to join represent these three table in my java class. </p>
  
  <p>The relationship between these tables are one to many. Hence, I want my Java classes to look something like this.  </p>
  
  <pre><code>@Entity(name = "A")
  @Table(name = "A")
  public class A {
  
         ??? Hibernate Annotation or query
         Map&lt;B,List&lt;C&gt;&gt; BMapC;
  }
  
  @Entity(name = "B")
  @Table(name = "B")
  public class B {
        ...
  }
  
  @Entity(name = "C")
  @Table(name = "C")
  public class C {
        ...
  }
  </code></pre>
  
  <p>I would like to know if it would be possible to leverage Hibernate Annotations for this. If not, is there a way I can write a custom query and populate the variable? </p>