title: I am trying to use dynamic order by but the list retrieved is not ordered
body: <pre><code>public List&lt;Series&gt; findSeries(int period, String fieldname, int num) {
      TypedQuery&lt;Series&gt; query = em.createQuery(
              "select s from Series s where  s.period = ?1 order by ?2",
              Series.class);
      query.setParameter(1, period);
      query.setParameter(2, fieldname);
      query.setMaxResults(num);
      return query.getResultList();
  }
  </code></pre>
  
  <p>This is the method I am using. I think order by isn't even getting executed,  it doesn't give any error even when I pass incorrect fieldname.</p>