ClusterVersionDAO extends CrudDAO<ClusterVersionEntity, Long> { @RequiresSession public List<ClusterVersionEntity> findByCluster(String clusterName) { final TypedQuery<ClusterVersionEntity> query = entityManagerProvider.get() .createNamedQuery("clusterVersionByCluster", ClusterVersionEntity.class); query.setParameter("clusterName", clusterName); return daoUtils.selectList(query); } ClusterVersionDAO(); @RequiresSession List<ClusterVersionEntity> findByStackAndVersion(String stackName,
      String stackVersion, String version); @RequiresSession ClusterVersionEntity findByClusterAndStackAndVersion(
      String clusterName, StackId stackId, String version); @RequiresSession List<ClusterVersionEntity> findByCluster(String clusterName); @RequiresSession ClusterVersionEntity findByClusterAndStateCurrent(String clusterName); @RequiresSession List<ClusterVersionEntity> findByClusterAndState(String clusterName, RepositoryVersionState state); @Override @Transactional void create(ClusterVersionEntity entity); @Transactional ClusterVersionEntity create(ClusterEntity cluster, RepositoryVersionEntity repositoryVersion,
                                     RepositoryVersionState state, long startTime, long endTime, String userName); @Transactional void updateVersions(Long clusterId, RepositoryVersionEntity target, RepositoryVersionEntity current);  }
@Test public void testFindByCluster() throws Exception { createRecordsUntilStep(1); Assert.assertEquals(0, clusterVersionDAO.findByCluster("non existing").size()); Assert.assertEquals(1, clusterVersionDAO.findByCluster(cluster.getClusterName()).size()); }