code: 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;
          }
      }
docs: Finds Dashboard in the database with the specified dashboard name and owned by the specified owner.
  
  @param   em             The entity manager to use.
  @param   dashboardName  The name of the dashboard to retrieve. Cannot be null or empty.
  @param   owner          The owner of the dashboard. Cannot be null.
  
  @return  The dashboard or null if no dashboard exists.