public static List < History > findHistoryByJob ( EntityManager em , BigInteger jobId , int limit ) { requireArgument ( em != null , "Entity manager cannot be null." ) ; requireArgument ( jobId != null , "The jobId cannot be null." ) ; requireArgument ( limit > 0 , "Limit must be a positive integer." ) ; TypedQuery < History > query = em . createNamedQuery ( "History.findByJob" , History . class ) ; query . setMaxResults ( limit ) ; try { query . setParameter ( "entityId" , jobId ) ; return query . getResultList ( ) ; } catch ( NoResultException ex ) { return new ArrayList < History > ( 0 ) ; } }
Finds all history records for the given job .