public static Alert findByNameAndOwner(EntityManager em,String alertName,PrincipalUser owner){
  requireArgument(em != null,"Entity manager can not be null.");
  requireArgument(alertName != null && !alertName.isEmpty(),"Alert name cannot be null or empty.");
  requireArgument(owner != null,"Owner cannot be null.");
  TypedQuery<Alert> query=em.createNamedQuery("Alert.findByNameAndOwner",Alert.class);
  query.setHint("javax.persistence.cache.storeMode","REFRESH");
  try {
    query.setParameter("name",alertName);
    query.setParameter("owner",owner);
    return query.getSingleResult();
  }
 catch (  NoResultException ex) {
    return null;
  }
}

public static Alert findByNameAndOwner ( EntityManager em , String alertName , PrincipalUser owner ) { requireArgument ( em != null , "Entity manager can not be null." ) ; requireArgument ( alertName != null && ! alertName . isEmpty ( ) , "Alert name cannot be null or empty." ) ; requireArgument ( owner != null , "Owner cannot be null." ) ; TypedQuery < Alert > query = em . createNamedQuery ( "Alert.findByNameAndOwner" , Alert . class ) ; query . setHint ( "javax.persistence.cache.storeMode" , "REFRESH" ) ; try { query . setParameter ( "name" , alertName ) ; query . setParameter ( "owner" , owner ) ; return query . getSingleResult ( ) ; } catch ( NoResultException ex ) { return null ; } }
finds an alert given its name and owner .
