public static Dashboard findByNameAndOwner ( EntityManager em , String dashboardName , PrincipalUser owner ) { TypedQuery < Dashboard > query = em . createNamedQuery ( "Dashboard.findByNameAndOwner" , Dashboard . class ) ; try { query . setParameter ( "name" , dashboardName ) ; query . setParameter ( "owner" , owner ) ; return query . getSingleResult ( ) ; } catch ( NoResultException ex ) { return null ; } }
Finds Dashboard in the database with the specified dashboard name and owned by the specified owner .