title: Using the DISTINCT keyword causes this error: not a SELECTed expression
body: <p>I have a query that looks something like this:</p>
  
  <pre><code>SELECT DISTINCT share.rooms
  FROM Shares share
    left join share.rooms.buildingAdditions.buildings.buildingInfoses as bi
  ... //where clause omitted
  ORDER BY share.rooms.floors.floorOrder, share.rooms.roomNumber,
           share.rooms.firstEffectiveAt, share.shareNumber, share.sharePercent
  </code></pre>
  
  <p>Which results in the following exception:</p>
  
  <pre><code>Caused by: org.hibernate.exception.SQLGrammarException: ORA-01791: not a SELECTed expression
  </code></pre>
  
  <p>If I remove the DISTINCT keyword, the query runs without issue.  If I remove the order by clause, the query runs without issue.  Unfortunately, I can't seem to get the ordered result set without duplicates.  </p>