title: Spring data JPA to join subclasses in query
body: <p>Consider this class:</p>
  
  <pre><code>@Entity
  @Table(name = "USER_TABLE")
  @Inheritance(strategy = InheritanceType.JOINED)
  public class User {
  
      @Id
      @GenericGenerator(name = "system-uuid", strategy = "uuid2")
      @GeneratedValue(generator="system-uuid")
      @Column(name = "id", unique = true)
      @Type(type= "org.hibernate.type.PostgresUUIDType")
      private UUID id;
  
      @Column(name = "USERNAME")
      private String userName;
  }
  </code></pre>
  
  <p>and its simple child:</p>
  
  <pre><code>@Entity
  @Table(name = "CUSTOMER")
  public class Customer extends User{
          //some extra fields
  }
  </code></pre>
  
  <p>I have another class having relation to user:</p>
  
  <pre><code>@Entity
  @Table(name = "USER_ACTIVITY")
  public class UserActivity {
  
      @ManyToOne
      @JoinColumn(name = "USERID")
      private User user;
  
      //id and other fields
  }
  </code></pre>
  
  <p>This is the tricky part. I want to fetch all objects of type UserActivity which relates to a "Customer". I tried something like this:</p>
  
  <pre><code>public interface UserActivityRepository extends PagingAndSortingRepository&lt;UserActivity,UUID&gt; {
      @Query("select u from UserActivity u join Customer.id")
      List&lt;UserActivity&gt; findAllByUserIsNotNullOrderByCreatedDesc(Pageable pageable);
  }
  </code></pre>
  
  <p>But hibernate tells me that I've specified an invalid path.</p>
  
  <p>Could you help me on this?</p>