@ SuppressWarnings ( "unchecked" ) public < T > List < T > getAll ( Class < T > entityCls ) { if ( entityCls == null ) { throw new IllegalArgumentException ( "entityCls cannot be null" ) ; } EntityManager entityManager = this . entityManagerProvider . get ( ) ; CriteriaBuilder builder = entityManager . getCriteriaBuilder ( ) ; CriteriaQuery < T > criteriaQuery = builder . createQuery ( entityCls ) ; criteriaQuery . from ( entityCls ) ; TypedQuery < T > typedQuery = entityManager . createQuery ( criteriaQuery ) ; List < T > results = typedQuery . getResultList ( ) ; return results ; }
Gets every instance of the specified entity in the database .