title: How to use Spring Data JPA Repository to query from 2 tables?
body: <p>I have 2 tables say Student and Teacher and say Student has a Many-To-One relationship to Teacher and say, teacherId serves as the foreign key.</p>
  
  <p>How can I use spring data JPA repo methods, in a way - <code>findByTeacherName</code>, if I want to query something like below,</p>
  
  <pre><code>select * from Student S, Teacher T 
      where T.teacherName = 'SACHIN' and S.teacherId = T.teacherId
  </code></pre>
  
  <p>Note : Here I wanna query using only <code>StudentRepository</code>, which is created using <code>StudentHibernateMapping</code> class that has a relationship to <code>TeacherHibernateMapping</code> class</p>
  
  <p>Any help will greatly be appreciated.</p>