code: 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);
          }
      }
docs: Finds all history records for the given job.
  
  @param   em     	Entity manager. Cannot be null.
  @param   jobId   The job for which the history will be returned. Cannot be null.
  @param   limit  	The number of results to return.
  
  @return  History belongs to given entity.