Spring Data @Query with Joins
<p>I am fairly new to Spring Data and I want to create a query that will allow me to do an Inner Join between two entities.</p>

<p>I have been using this stack overflow to try to clarify certain aspects:</p>

<p><a href="https://stackoverflow.com/questions/13154818/how-to-define-a-jpa-repository-query-with-a-join">How To Define a JPA Repository Query with a Join</a></p>

<p>It gives the answer of structuring the query as so:</p>

<pre><code>@Query("select u.userName from User u inner join u.area ar where ar.idArea = :idArea")
</code></pre>

<p>However in this query I dont see where it manages to define "ar" as neither of the entity classes actually define "ar" within themselves? Any clarification on this would be greatly appreciated!</p>