This is a rather simple jpa query but the ordering is never working. doesn´t matter if i add ASC or DESC
SELECT hfp FROM Lap l INNER JOIN l.footprints hfp WHERE l.id = :id ORDER BY hfp.date ASC
After this query my output is always the same.
Query query = em.createNamedQuery("findHardwareFootprintsWithLapIdOrderByDateASC");
query.setParameter("id", lapId);
List<HardwareFootprint> results = query.getResultList();
System.out.println(results);
Output:
[Footprint[ id=21 type=NormalHandshake date=05/10/2014 08:13:41.808], Footprint[ id=20 type=NormalHandshake date=05/10/2014 08:13:21.123], Footprint[ id=18 type=NormalHandshake date=05/10/2014 08:13:11.512]]
SQL Log:
SELECT t0.ID, t0.DATE, t0.TYPE FROM HARDWAREFOOTPRINT t0, LAP_HARDWAREFOOTPRINT t2, LAP t1 WHERE ((t1.ID = ?) AND ((t2.Lap_ID = t1.ID) AND (t0.ID = t2.footprints_ID))) ORDER BY t0.DATE ASC
Anybody an idea?