public static List<Audit> findByEntity(EntityManager em,JPAEntity entity,BigInteger limit){
  requireArgument(em != null,"Entity manager cannot be null.");
  requireArgument(entity != null,"Entity cannot be null.");
  TypedQuery<Audit> query=em.createNamedQuery("Audit.findByJPAEntity",Audit.class);
  if (limit != null) {
    query.setMaxResults(limit.intValue());
  }
  try {
    query.setParameter("jpaEntity",entity);
    return query.getResultList();
  }
 catch (  NoResultException ex) {
    return new ArrayList<Audit>(0);
  }
}

public static List < Audit > findByEntity ( EntityManager em , JPAEntity entity , BigInteger limit ) { requireArgument ( em != null , "Entity manager cannot be null." ) ; requireArgument ( entity != null , "Entity cannot be null." ) ; TypedQuery < Audit > query = em . createNamedQuery ( "Audit.findByJPAEntity" , Audit . class ) ; if ( limit != null ) { query . setMaxResults ( limit . intValue ( ) ) ; } try { query . setParameter ( "jpaEntity" , entity ) ; return query . getResultList ( ) ; } catch ( NoResultException ex ) { return new ArrayList < Audit > ( 0 ) ; } }
finds all alerts for the given entity .
