title: How to inner join two tables using Hibernate HQL or Criteria?
body: <pre><code>@Entity
  public class doctor {
     @Id
     private int id;
     private String username;
     private String password;
     private String phone;
     private String email;
  
     @OneToMany(targetEntity = patient.class, cascade = CascadeType.ALL, mappedBy = "doctor")
     @Cascade(value = org.hibernate.annotations.CascadeType.ALL)
     private Collection&lt;patient&gt; patients = new ArrayList&lt;patient&gt;();
  }
  
  @Entity
  public class patient {
     @Id
     private int id;
     private String name;
     private String surname;
     private String phone;
     private int systolic;
     private int diastolic;
  
     @ManyToOne
     private doctor doctor;
  }
  </code></pre>
  
  <p>For now i can retreive only doctors information by this criteria:</p>
  
  <pre><code>Criteria query = session.createCriteria(doctor.class);
  query.createCriteria("patients", "p");
  query.add(Restrictions.eq("p.phone", phone));
  List&lt;doctor&gt; doctorList = (ArrayList&lt;doctor&gt;) query.list();
  </code></pre>
  
  <p>How i can with hibernate criteria retreive by giving patient phone, his doctor information and some patients information?</p>
  
  <blockquote>
    <p>Something like : phone=3423423424 , then answear is :</p>
    
    <p>-------------doctor's info----------------------------------patientinfo(systolic,diastolic)-----------------------</p>
  </blockquote>
  
  <pre><code>  1 "Dr dre" sdfssd 243242 drdre@gmail.com  160 170
  </code></pre>
  
  <p>where <code>160 170</code> are the patient's information</p>
  
  <p>If not with criteria, with HQL?</p>