I am using spring data and my DAO looks like
public interface StudentDAO extends JpaRepository { public findAllOrderByIdAsc
Simple way:
repository.findAll(Sort.by(Sort.Direction.DESC, "colName"));
Source: https://www.baeldung.com/spring-data-sorting