title: Spring data jpa JOIN does't work in @Query
body: <p>I am using spring-data-jpa. I wrote a native query but it doesn't work. Here is my entity classes:</p>
  
  <pre><code>@Entity
  @Table(name="view_version")
  public class ViewVersionDom {
  
  @Id
  @GeneratedValue(strategy=GenerationType.IDENTITY)
  private Long id;
  
  @ManyToOne
  @JoinColumn(name="view_id")
  private ViewDom view;
  
  private Integer version;
  
  @ManyToOne
  @JoinColumn(name="datasource_param_id")
  private DatasourceParamDom datasourceParam;
  
  private String description;
  
  @Column(name="created_date")
  private Date createdDate;
  </code></pre>
  
  <hr>
  
  <pre><code>@Entity
  @Table(name="view_permission")
  public class ViewPermissionDom extends BaseDom {
  private static final long serialVersionUID = 1L;
  
  @Id
  @GeneratedValue(strategy=GenerationType.IDENTITY)
  private Long id;
  
  @ManyToOne
  @JoinColumn(name="view_id")
  private ViewDom view;
  
  @ManyToOne
  @JoinColumn(name="user_id")
  private UserDom user;
  
  @ManyToOne
  @JoinColumn(name="group_id")
  private GroupDom group;
  
  private Boolean read;
  
  private Boolean write;
  
  private Boolean execute;
  </code></pre>
  
  <p>Here is the query:</p>
  
  <pre><code>@Query(value = " SELECT v FROM ViewVersionDom v LEFT JOIN ViewPermissionDom vp ON v.view.id = vp.id " 
           + " where (v.view.user.id = ?1 OR (vp.read=true and (vp.user.id=?1 or vp.user.id is NULL and vp.group.id is NULL or vp.group.id in (?2)))) "
           + " ORDER BY v.view.name", nativeQuery=true)
  public List&lt;ViewVersionDom&gt; findUserViews(Long userId, List&lt;Long&gt; groupIds);
  </code></pre>
  
  <p>At first when I didn't write nativeQuery=true the application didn't build and I got an exception 'path expected for join jpa'. When I set the settings nativeQuery=true the application is started, but when I call the function I got the following error: </p>
  
  <pre><code>org.hibernate.engine.jdbc.spi.SqlExceptionHelper - [ERROR: relation "viewversiondom" does not exist Position: 16] 
  org.hibernate.exception.SQLGrammarException: could not extract ResultSet] 
  </code></pre>
  
  <p>Does there any other settings or annotation that will resolve the problem? 
  I have searched in google, but in all cases 2 tables connected with each other directly. </p>