title: Group by clause in HQL
body: <p>How to write the given sql in HQL in hibernate and get an array of object which contains two columns</p>
  
  <pre><code>select specialization, count(specialization) 
  from ocs_tbl_doctor group by specialization;
  </code></pre>
  
  <p>Mapping Bean class is </p>
  
  <p><strong>DoctorBean.java</strong></p>
  
  <pre><code>@Entity
  @Table(name = "OCS_TBL_DOCTOR")
  public class DoctorBean {
  
  @Id
  @Column(name = "DOCTORID")
  private String doctorID;
  
  @Column(name = "DOCTORNAME")
  private String doctorName;
  
  @Column(name = "DATEOFBIRTH")
  private Date dateOfBirth;
  
  @Column(name = "DATEOFJOINING")
  private Date dateOfJoining;
  
  @Column(name = "GENDER")
  private String gender;
  
  @Column(name = "QUALIFICATION")
  private String qualification;
  
  @Column(name = "SPECIALIZATION")
  private String specialization;
  
  @Column(name = "YEARSOFEXPERIENCE")
  private int yearsOfExperience;
  
  @Column(name = "STREET")
  private String street;
  
  @Column(name = "LOCATION")
  private String location;
  
  @Column(name = "CITY")
  private String city;
  
  @Column(name = "STATE")
  private String state;
  
  @Column(name = "PINCODE")
  private String pincode;
  
  @Column(name = "CONTACTNUMBER")
  private String contactNumber;
  
  @Column(name = "EMAILID")
  private String emailID;
  
  //getters and setters
  }
  </code></pre>
  
  <p>I am having problem in projecting the second column i.e (count(specialization))</p>