title: Joining two table entities in Spring Data JPA
body: <p>I want to write a query like <code>SELECT * FROM Release_date_type a LEFT JOIN cache_media b on a.id=b.id</code>. I am new to Spring Data JPA. I don't know how to write entities for Join query. Here is an attempt:</p>
  
  <pre><code>@Entity
  @Table(name = "Release_date_type")
  public class ReleaseDateType {
  
      @Id
      @GeneratedValue(strategy=GenerationType.TABLE)
      private Integer release_date_type_id;
      // ...
      @Column(nullable = true) 
      private Integer media_Id;
      // with getters and setters...
  }
  </code></pre>
  
  <p>Another entity is: </p>
  
  <pre><code>@Entity
  @Table(name = "Cache_Media")
  public class CacheMedia {
  
      @Id
      @GeneratedValue(strategy=GenerationType.TABLE)
      private Integer id;
      // ...
      private Date loadDate; //with the getter and setter ..
  }
  </code></pre>
  
  <p>I want to write a <code>crudRepository</code> interface such as </p>
  
  <pre><code>public interface ReleaseDateTypeRepository extends CrudRepository&lt;ReleaseDateType, Long&gt;{
      @Query("SELECT * FROM Release_date_type a LEFT JOIN cache_media b on a.id=b.id")
      public List&lt;ReleaseDateType&gt; FindAllWithDescriptionQuery();
  }
  </code></pre>