Hi,
I was rewriting our DAO to support pagging in large dataset and I think I have found a problem with sorting. I send you a test case - sorry for using the same project as previous, but it was faster to write this test case. As usual, you can load data with DataLoader and then check problem with QueryData.
There is a simple query with "order by" sentence:
List<Branch> prodList = null;
TypedQuery<Branch> icQuery = null;
String q = null;
q = "select br from Branch br ORDER BY ?1 DESC";
icQuery = em.createQuery(q, Branch.class);
icQuery.setParameter(1, "br.id");
This query should return all the branches sorted descending, but I get this result:
Branch: 100
Branch: 101
Branch: 102
Branch: 103
Branch: 104
Branch: 105
Branch: 106
Branch: 107
Branch: 108
Branch: 109
Branch: 110
Branch: 111
Branch: 112
Branch: 113
The same if I use setFirstResult() and setMaxResult();