public < T extends HistoricalEntity < ? > > List < T > getCurrent ( Class < T > historicalEntityCls ) { EntityManager entityManager = this . entityManagerProvider . get ( ) ; CriteriaBuilder builder = entityManager . getCriteriaBuilder ( ) ; CriteriaQuery < T > criteriaQuery = builder . createQuery ( historicalEntityCls ) ; Root < T > root = criteriaQuery . from ( historicalEntityCls ) ; criteriaQuery . where ( expiredAt ( root , builder ) ) ; TypedQuery < T > typedQuery = entityManager . createQuery ( criteriaQuery ) ; return typedQuery . getResultList ( ) ; }
Gets every instance of the specified historical entity in the database .