I am using spring data and my DAO looks like
public interface StudentDAO extends JpaRepository {
public findAllOrderByIdAsc
public interface StudentDAO extends JpaRepository {
public List findAllByOrderByIdAsc();
}
The code above should work. I'm using something similar:
public List findTop10ByOrderByLevelDesc();
It returns 10 rows with the highest level.
IMPORTANT: Since I've been told that it's easy to miss the key point of this answer, here's a little clarification:
findAllByOrderByIdAsc(); // don't miss "by"
^