title: How to create a many-to-many relation with an intermediate table
body: <p>I want to create a many-to-many relation with an intermediate table with extra fields in this intermediate table, just like that:
  <a href="https://i.imgur.com/GFSMuK6.png" rel="nofollow noreferrer">https://i.imgur.com/GFSMuK6.png</a></p>
  
  <p>and I just made this mapping, can this work?</p>
  
  <pre><code>@Entity
  public class Personagem {
      @Id
      private Long Id;
  
      @Index(type = IndexType.HASH)
      @Unique
      private String nome;
  
      private ToMany&lt;Classe&gt; classes;
  </code></pre>