title: JPA 2 CriteriaQuery order by index
body: <p>I have an Entity with a <code>List&lt;EntityRevision&gt;</code> contained in it.  The collection has an <code>@OrderColumn</code>.</p>
  
  <p>I'd like to get all the <code>EntityRevisions</code> for an Entity ordered by their index.</p>
  
  <p>I can do this with the following query:</p>
  
  <pre><code>SELECT er 
    FROM Entity e JOIN e.revisions er 
    WHERE e.id = :entityId 
    ORDER BY index(er)
  </code></pre>
  
  <p>But I can't figure out how to do this with the <code>CriteriaQuery</code>.</p>
  
  <p>Using EclipseLink 2.3.2 / JPA 2.0.3 - the <code>Root&lt;EntityRevision&gt;</code> has no <code>index()</code> method on it that I can use in the orderBy.</p>
  
  <p>Any ideas?</p>