title: Joining two table in spring data JPA and Querying two table data from repository
body: <p>I am using Sprind JPA, Spring 3.1.2(in future 3.2.3), Hibernate 4.1 final.
  I am new to Sprind Data JPA. I have tow Table Release_date_type and Cache_media which entities are as follows :</p>
  
  <p>ReleaseAirDate.java</p>
  
  <pre><code>@Entity
  @Table(name = "Release_date_type")
  public class ReleaseDateType {
      @Id
      @GeneratedValue(strategy=GenerationType.TABLE)
      private Integer release_date_type_id;
      @Column
      private Integer sort_order;
      @Column
      private String description;
      @Column
      private String data_source_type;
      @Column(nullable = true) 
      private Integer media_Id;
      @Column
      private String source_system; with getters and setters..
  </code></pre>
  
  <p>and CacheMedia as </p>
  
  <pre><code>@Entity
  @Table(name = "Cache_Media")
  public class CacheMedia {   
      @Id
      @GeneratedValue(strategy=GenerationType.TABLE)
      private Integer id;
      @Column(name="code")
      private String code;
      @Column(name="POSITION")
      private Integer position;
      @Column(name="DESCRIPTION")
      private String media_Description; with setter and getters.
  </code></pre>
  
  <p>Now my repository interface is as follows : </p>
  
  <pre><code>public interface ReleaseDateTypeRepository extends CrudRepository&lt;ReleaseDateType, Long&gt;{ }
  </code></pre>
  
  <p>Now i want to write a method(Query) in <code>ReleaseDateTypeRepository</code> interface which can get all the data from <code>Release_Date_Type</code> table including appropriate <code>media_description</code> from Table 'Cache_Media' based on <code>media_id</code> of <code>Release_date_type</code> table.</p>
  
  <p>So my select (SQL)query looks like </p>
  
  <p><code>SELECT * from Release_Date_Type r left join Cache_Media c on r.media_id=c.id</code></p>
  
  <p>I don't know how to map entities.
  I tried so many thing but not luck.
  Any help is appreciated.</p>