public static List < Namespace > findByOwner ( EntityManager em , PrincipalUser owner ) { SystemAssert . requireArgument ( em != null , "EntityManager cannot be null." ) ; SystemAssert . requireArgument ( owner != null , "Owner cannot be null or empty." ) ; TypedQuery < Namespace > query = em . createNamedQuery ( "Namespace.findByOwner" , Namespace . class ) ; try { return query . setParameter ( "owner" , owner ) . getResultList ( ) ; } catch ( NoResultException ex ) { return new ArrayList <> ( 0 ) ; } }
Finds all namespaces for a given owner .