code: public static List<Dashboard> findDashboards(EntityManager em, Integer limit, String version) {
      	requireArgument(em != null, "Entity manager can not be null.");
          TypedQuery<Dashboard> query;
  
          if(version==null) {
              query= em.createNamedQuery("Dashboard.getDashboards", Dashboard.class);
          }
          else
          {
              query = em.createNamedQuery("Dashboard.getDashboardsByVersion", Dashboard.class);
              query.setParameter("version",version);
          }
          try {
              if (limit != null) {
                  query.setMaxResults(limit);
              }
              return query.getResultList();
          } catch (NoResultException ex) {
              return new ArrayList<>(0);
          }
      }
docs: Returns dashboards ordered by owner and dashboard name.
  
  @param   em     The entity manager to use.  Cannot be null.
  @param   limit  The maximum number of dashboards to retrieve.  If null, all records will be returned, otherwise must be a positive non-zero number.
  @param   version The version of the dashboard to retrieve. It is either null or not empty
  
  @return  The list of dashboards.  Will never be null but may be empty.