public static List < Audit > findByHostName ( EntityManager em , String hostName ) { requireArgument ( em != null , "Entity manager cannot be null." ) ; requireArgument ( hostName != null && ! hostName . isEmpty ( ) , "Host name cannot be null or empty." ) ; TypedQuery < Audit > query = em . createNamedQuery ( "Audit.findByHostName" , Audit . class ) ; try { query . setParameter ( "hostName" , hostName ) ; return query . getResultList ( ) ; } catch ( NoResultException ex ) { return new ArrayList < Audit > ( 0 ) ; } }
Finds all alerts created by given host name .