title: how to make two column as a primary key in hibernate annotation class
body: <p>This is my annotation class and i want <code>userId</code> and <code>groupId</code> column both as primary key.
  I have found more questions (<a href="https://stackoverflow.com/q/10422680/3156758">Question</a>) about this, but didn't found relevant answer.
  I have less reputation, so I am not able to comment on posts, So I am putting my question here.</p>
  
  <p>This is my code..</p>
  
  <pre><code>import javax.persistence.Column;
  import javax.persistence.EmbeddedId;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.Table;
  
  import org.hibernate.annotations.NaturalId;
  
  @Entity
  @Table(name="user_group")
  public class user_group {
  
  @Column(name="serviceProvider")
  private String serviceProvider;
  
  @Column(name="enterpriseId")
  private String enterpriseId;
  
  @Column(name="department")
  private String department;
  
  @Column(name="trunkGroupName")
  private String trunkGroupName;
  @Id
  @Column(name="userId")
  private String userId;
  
  
  @Column(name="groupId")
  private String group;
  
  
  public String getUserId() {
      return userId;
  }
  
  
  public void setUserId(String userId) {
      this.userId = userId;
  }
  
  
  public String getGroup() {
      return group;
  }
  
  
  public void setGroup(String group) {
      this.group = group;
  }
  
  public String getServiceProvider() {
      return serviceProvider;
  }
  
  public void setServiceProvider(String serviceProvider) {
      this.serviceProvider = serviceProvider;
  }
  
  public String getEnterpriseId() {
      return enterpriseId;
  }
  
  public void setEnterpriseId(String enterpriseId) {
      this.enterpriseId = enterpriseId;
  }
  
  public String getDepartment() {
      return department;
  }
  
  public void setDepartment(String department) {
      this.department = department;
  }
  
  public String getTrunkGroupName() {
      return trunkGroupName;
  }
  
  public void setTrunkGroupName(String trunkGroupName) {
      this.trunkGroupName = trunkGroupName;
  }
  
  
  }
  </code></pre>