title: QueryDSL Left Join with additional conditions in ON
body: <p>Is it possible to do the following query in QueryDSL? </p>
  
  <pre><code>SELECT p.*
  FROM parts_table p LEFT JOIN inventory_balance_table i ON 
      (p.part_no = i.part_no 
       AND i.month = MONTH(CURRENT_DATE) 
       AND i.year = YEAR(CURRENT_DATE));
  </code></pre>
  
  <p>Inventory balance stores inventory data for every part number/month/year; I need the only the data for the current year and month. </p>
  
  <p>I've gotten the basic left join down: </p>
  
  <pre><code>QPartsTable qParts = QPartsTable.partsTable;
  QInventoryBalance qBalance = QInventoryBalance.inventoryBalance;
  
  JPAQuery q = new JPAQuery(em);
  q.from(qParts).leftJoin(qParts.inventoryBalance, qBalance);
  q.where(...);
  List&lt;Part&gt; list = q.list(qParts);
  </code></pre>
  
  <p>which makes the correct sql, but only joining on the part number. </p>
  
  <p>The resulting parts are checked for stock availability (among other things). The left join is necessary, because I still need parts that don't have an inventory entry yet (new parts for instance). Left join will get those without a matching inventory balance, but adding <code>month = MONTH(CURRENT_DATE)</code> and so on to where clause of the query removes the rows without an inventory balance (because they don't have year/month data). </p>
  
  <p>For the same reason <code>@Where</code> and <code>@Filter</code> would remove those parts from the resulting parts list and are not applicable. Sadly <code>@Filter</code> and <code>@Where</code> are the only other results I'm getting with a search in Google and here on SO. (Oddly the Filter doesn't even affect the query even if filters are enabled in the session...) </p>
  
  <p>The simplest solution would be my original question: How to turn the above SQL into QueryDSL? In general, is it possible to add more and/or custom conditions to the ON clause of the left join? What are the alternative solutions to this problem? </p>
  
  <p>Thanks in advance! </p>
  
  <hr>
  
  <p><strong>Update</strong> - A follow-up question and an observation: (Perhaps this should be a new question entirely?)</p>
  
  <p>After looking through the docs, it seems the older blogs demonstrating querydsl had the <code>on()</code> function for <code>leftJoin</code>'s. Why is this no longer the case? </p>
  
  <p><code>SQLQuery</code> (or <code>HibernateSQLQuery</code> or some other variety) has the on() function, but leftJoin() accepts <code>RelationalPath&lt;T&gt;</code>, not an <code>EntityPath&lt;T&gt;</code> as <code>JPAQuery</code> does. It seems impossible to cast QClasses to a <code>RelationalPath</code>, so that's probably not the way to go...</p>
  
  <hr>
  
  <p><strong>Update 2</strong> - We're using 2.9.0. Using <code>on()</code> gives an error, like it doesn't exist... </p>