title: How to handle join query in Hibernate and Spring with annotations?
body: <p>I am developing application using Spring and Hibernate with MySQL. I am new to Hibernate and did basic tasks...</p>
  
  <p>Now I need to apply joins in select query to get data from multiple table using annotations. I have searched for it but still I didn't get any idea...</p>
  
  <p><strong>Here my database tables and bean classes :</strong></p>
  
  <pre><code>Table 1: 'employee_info' ( id, empid, empname, doj and jobtitle )
  
  Table 2: 'employee_login' ( username, password, status and empid )
  </code></pre>
  
  <p>And my bean classes are:</p>
  
  <p><strong>EmployeeInfoForm.java</strong></p>
  
  <pre><code>@Entity()
  @Table(name = "employee_info")
  public class EmployeeInfoForm {
  
  @Id
  @GeneratedValue
  @Column(name = "id", unique = true, nullable = true)
  private int id;
  
  @Column(name = "empId")
  private int empId;
  
  @Column(name = "empname")
  private String empName;
  
  @Column(name = "doj")
  private Date empDoj;
  
  @Column(name = "jobtitle")
  private String empJobTitle;
  
  public int getEmpId() {
      return empId;
  }
  
  public void setEmpId(int empId) {
      this.empId = empId;
  }
  
  public void setEmpDoj(Date empDoj) {
      this.empDoj = empDoj;
  }
  
  public String getEmpName() {
      return empName;
  }
  
  public void setEmpName(String empName) {
      this.empName = empName;
  }
  
  public Date getEmpDoj() {
      return empDoj;
  }
  
  public void setEmp_Doj(Date empDoj) {
      this.empDoj = empDoj;
  }
  
  public String getEmpJobTitle() {
      return empJobTitle;
  }
  
  public void setEmpJobTitle(String empJobTitle) {
      this.empJobTitle = empJobTitle;
  }
  
  
  }
  </code></pre>
  
  <p><strong>EmployeeLoginForm.java</strong></p>
  
  <pre><code>@Entity()
  @Table(name = "employee_login")
  public class EmployeeLoginForm {
  
  @Id
  @Column(name = "username")
  private String empUserName;
  
  @Column(name = "password")
  private String empPassword;
  
  @Column(name = "status")
  private String empStatus;
  
  @Column(name = "empid")
  private int empId;
  
  public String getEmpUserName() {
      return empUserName;
  }
  
  public int getEmpId() {
      return empId;
  }
  
  public void setEmpId(int empId) {
      this.empId = empId;
  }
  
  public void setEmpUserName(String empUserName) {
      this.empUserName = empUserName;
  }
  
  public String getEmpPassword() {
      return empPassword;
  }
  
  public void setEmpPassword(String empPassword) {
      this.empPassword = empPassword;
  }
  
  public String getEmpStatus() {
      return empStatus;
  }
  
  public void setEmpStatus(String empStatus) {
      this.empStatus = empStatus;
  }
  
  }
  </code></pre>
  
  <p><strong>Requirement:</strong></p>
  
  <p>I want to select fields <strong>empid, empname, jobtitle</strong> from <strong>employee_info</strong> and field <strong>status</strong> from <strong>employee_login</strong> table when the empid matches on both table...</p>
  
  <p>Please help me to complete my work...</p>
  
  <p>Any suggestions and guidance are appreciated...</p>