code: public static List<Dashboard> findDashboardsByOwner(EntityManager em, PrincipalUser user, String version) {
      	requireArgument(em != null, "Entity manager can not be null.");
          TypedQuery<Dashboard> query;
          if(version==null) {
              query = em.createNamedQuery("Dashboard.getDashboardsByOwner", Dashboard.class);
          }
          else
          {
              query = em.createNamedQuery("Dashboard.getDashboardsByOwnerAndByVersion", Dashboard.class);
              query.setParameter("version",version);
          }
  
          try {
              query.setParameter("owner", user);
              return query.getResultList();
          } catch (NoResultException ex) {
              return new ArrayList<>(0);
          }
      }
docs: Returns the list of dashboards owned by the user.
  
  @param   em    The entity manager to use. Cannot be null.
  @param   user  The user to retrieve dashboards for. Cannot be null.
  @param   version The version of the dashboard to retrieve. It is either null or not empty
  
  @return  The list of owned dashboards. Will not be null, but may be empty.