protected List < T > getListAsc ( SingularAttribute < T , ? > attribute ) { EntityManager entityManager = this . getEntityManager ( ) ; CriteriaBuilder builder = entityManager . getCriteriaBuilder ( ) ; CriteriaQuery < T > criteriaQuery = builder . createQuery ( getEntityClass ( ) ) ; Root < T > root = criteriaQuery . from ( getEntityClass ( ) ) ; criteriaQuery . orderBy ( builder . asc ( root . get ( attribute ) ) ) ; return entityManager . createQuery ( criteriaQuery ) . getResultList ( ) ; }
Gets all of this DAO s entities ordered by the provided attribute in ascending order .