@RequiresSession
  public List<WidgetEntity> findByCluster(long clusterId) {
    TypedQuery<WidgetEntity> query = entityManagerProvider.get()
            .createNamedQuery("WidgetEntity.findByCluster", WidgetEntity.class);
    query.setParameter("clusterId", clusterId);

    return daoUtils.selectList(query);
  }
DAO utilities for dealing mostly with {@link TypedQuery} results.
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/WidgetDAO.java