private static List<ClusterConfigEntity> getEnabledConfigsByType(long clusterId, String type) {

    Provider<EntityManager> entityManagerProvider = injector.getProvider(EntityManager.class);
    EntityManager entityManager = entityManagerProvider.get();

    Query query = entityManager.createNamedQuery("ClusterConfigEntity.findEnabledConfigByType",ClusterConfigEntity.class);
    query.setParameter("clusterId", clusterId);
    query.setParameter("type", type);

    return (List<ClusterConfigEntity>) query.getResultList();
  }
Find ClusterConfigs with selected = 1
@return ClusterConfigs that are not mapped to Service by type
ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java