title: spring jpa onetomany relationship @Query not working
body: <p>I am trying to pull all article records by joining the feeds table and filtering on it's source_id field.</p>
  
  <p>My Repository:</p>
  
  <pre><code>package com.infostream.repositories;
  
  import org.springframework.data.domain.Page;
  import org.springframework.data.domain.Pageable;
  import org.springframework.data.jpa.repository.Query;
  import org.springframework.data.repository.PagingAndSortingRepository;
  
  import com.infostream.models.Article;
  import java.lang.String;
  
  public interface ArticleRepositoryImpl extends PagingAndSortingRepository&lt;Article, Long&gt; {
      Page&lt;Article&gt; findAll(Pageable pageRequest);
  
      Page&lt;Article&gt; findByFeedId(String feedId, Pageable pageable);
  
      @Query("select a from Article a join Feed f where f.source_id = ?1");
      Page&lt;Article&gt; findBySourceId(String sourceId, Pageable pageable);
  }
  </code></pre>
  
  <p>The Feed model:</p>
  
  <pre><code>package com.infostream.models;
  
  import java.util.Date;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.Table;
  import javax.validation.constraints.NotNull;
  
  import com.fasterxml.jackson.databind.annotation.JsonSerialize;
  import com.infostream.serializers.JsonDateSerializer;
  
  @Entity
  @Table(name="feeds")
  public class Feed extends Base {
  
      @Column(name = "source_id", nullable = false)
      private String sourceId;
  
      @Column(name = "category_id", nullable = false)
      private String categoryId;
  
      @NotNull
      @Column(columnDefinition="text")
      private String url;
  
      @Column(name = "last_visited")
      private Date lastVisited;
  
      public Feed() {
      }
  
      public Feed(String sourceId, String categoryId, String url) {
          this.sourceId = sourceId;
          this.categoryId = categoryId;
          this.url = url;
      }
  
      @JsonSerialize(using = JsonDateSerializer.class)
      public Date getLastVisited() {
          return lastVisited;
      }
  
      public void setLastVisited(Date lastVisited) {
          this.lastVisited = lastVisited;
      }
  
      public String getSourceId() {
          return sourceId;
      }
  
      public void setSourceId(String sourceId) {
          this.sourceId = sourceId;
      }
  
      public String getCategoryId() {
          return categoryId;
      }
  
      public void setCategoryId(String categoryId) {
          this.categoryId = categoryId;
      }
  
      public String getUrl() {
          return url;
      }
  
      public void setUrl(String url) {
          this.url = url;
      }
  
  
  
  }
  </code></pre>
  
  <p>The Article model:</p>
  
  <pre><code>package com.infostream.models;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.Table;
  import javax.validation.constraints.NotNull;
  
  @Entity
  @Table(name = "articles")
  public class Article extends Base {
  
      public Article() {
  
      }
  
      public Article(String feedId, String title, String description, String url) {
          this.feedId = feedId;
          this.title = title;
          this.description = description;
          this.url = url;
      }
  
      public String getTitle() {
          return title;
      }
  
      public void setTitle(String title) {
          this.title = title;
      }
  
      public String getDescription() {
          return description;
      }
  
      public void setDescription(String description) {
          this.description = description;
      }
  
      public String getUrl() {
          return url;
      }
  
      public void setUrl(String url) {
          this.url = url;
      }
  
      public String getImgUrl() {
          return imgUrl;
      }
  
      public void setImgUrl(String imgUrl) {
          this.imgUrl = imgUrl;
      }
  
      public String getFeedId() {
          return feedId;
      }
  
      public void setFeedId(String feedId) {
          this.feedId = feedId;
      }
  
      @Column(name = "feed_id", nullable = false)
      private String feedId;
  
      @NotNull
      @Column(columnDefinition="text")
      private String title;
  
      @Column(name = "img_url", columnDefinition="text")
      private String imgUrl;
  
      @Column(columnDefinition="text")
      private String description;
  
      @NotNull
      @Column(columnDefinition="text")
      private String url;
  
      @Override
      public String toString() {
          return "Article [feedId=" + feedId + ", title=" + title + ", imgUrl=" + imgUrl + ", description=" + description
                  + ", url=" + url + "]";
      }   
  
  
  }
  </code></pre>
  
  <p>The error i am getting:</p>
  
  <pre><code>Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: Path expected for join! [select a from com.infostream.models.Article a join Feed f where f.source_id = ?1]
  </code></pre>
  
  <p>I have tried mapping OneToMany before which got me the same error, does anyone have a good example where this is shown? I am not trying to filter on feed_id. I am filtering on source_id which is a field on the feeds table.</p>
  
  <p>Essentially, what i am trying to achieve is merely abstract this raw sql query into springs and hibernates way of doing things:</p>
  
  <pre><code>select a.* from articles as a join feeds as f on(a.feed_id = f.id) where f.source_id = 'some_source_id';
  </code></pre>