title: Path references in QueryDSL join to subquery
body: <p>I'd like to know the best way to implement this query in SQL-style QueryDSL which joins to a subquery. I struggled a bit, but got it to generate the necessary SQL.  I'm wondering if there are any simplifications/improvements, however, particularly related to the three "paths" I had to create? For example, would be great to define latestCaseId in terms of latestSubQuery.</p>
  
  <p>In the simplified form of my actual query below, I am finding the set of records (fields spread across <code>ucm</code> and <code>pcm</code>) which have the latest timestamp per case group.  The subquery identifies the latest timestamp per group so that we can filter the outer query by it.</p>
  
  <pre><code>  final SimplePath&lt;ListSubQuery&gt; latestSubQueryPath = Expressions.path(ListSubQuery.class, "latest");
    final SimplePath&lt;Timestamp&gt; caseLatestMentioned = Expressions.path(Timestamp.class, "caseLatestMentioned");
    final SimplePath&lt;Integer&gt; latestCaseId = Expressions.path(Integer.class, "latest.caseId");
  
    final ListSubQuery&lt;Tuple&gt; latest = new SQLSubQuery()
            .from(ucm2)
            .innerJoin(pcm2).on(ucm2.id.eq(pcm2.id))
            .groupBy(pcm2.caseId)
            .list(pcm2.caseId.as(latestCaseId), ucm2.lastExtracted.max().as(caseLatestMentioned));
  
    q.from(ucm)
            .join(pcm).on(ucm.id.eq(pcm.id))
            .innerJoin(latest, latestSubQueryPath).on(pcm.caseId.eq(latestCaseId))
            .where(ucm.lastExtracted.eq(caseLatestMentioned));
  </code></pre>