public static List<Alert> findByPrefix(EntityManager em,String prefix){
  requireArgument(em != null,"Entity Manager cannot be null");
  requireArgument(prefix != null && !prefix.isEmpty(),"Cannot find alerts starting with null of empty prefix");
  TypedQuery<Alert> query=em.createNamedQuery("Alert.findByPrefix",Alert.class);
  query.setHint("javax.persistence.cache.storeMode","REFRESH");
  try {
    query.setParameter("name",prefix + "%");
    return query.getResultList();
  }
 catch (  NoResultException ex) {
    return new ArrayList<>(0);
  }
}

public static List < Alert > findByPrefix ( EntityManager em , String prefix ) { requireArgument ( em != null , "Entity Manager cannot be null" ) ; requireArgument ( prefix != null && ! prefix . isEmpty ( ) , "Cannot find alerts starting with null of empty prefix" ) ; TypedQuery < Alert > query = em . createNamedQuery ( "Alert.findByPrefix" , Alert . class ) ; query . setHint ( "javax.persistence.cache.storeMode" , "REFRESH" ) ; try { query . setParameter ( "name" , prefix + "%" ) ; return query . getResultList ( ) ; } catch ( NoResultException ex ) { return new ArrayList < > ( 0 ) ; } }
finds all alerts whose name starts with the given prefix .
