title: Use a Composite key of an entity as the ManyToMany key in another entity
body: <p>I have the following case, I am trying to do a many to many mapping like a User and all the teams in which the user belongs to.</p>
  <pre><code>    Class AID
         private int b
         private int c
      
      @IdClass(AID.class)
      Class A
     
        @Id
        @SequenceGenerator(name = &quot;b_seq&quot;, sequenceName = &quot;id_seq&quot;, allocationSize = 1)
        @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = &quot;b_seq&quot;)
        private int b
      
        @Id
        @Column(name = &quot;col_c&quot;)
        private int c
      
      Class D
      #need to define a many to many mapping with A here
  </code></pre>
  <p>Assuming class D is the Teams class and class A has a composite key as primary key how would I proceed?</p>