@Test public void testgetCountByName() { Assert.assertTrue(clusterConfigDao.getCountByName("test") == 0); ClusterConfig clusterConfig = new ClusterConfig(1, "test", "test1"); clusterConfigDao.insert(clusterConfig); Assert.assertTrue(clusterConfigDao.getCountByName("test") == 1); }
public long getCountByName(String name) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); return jdbcTemplate.queryForObject( "SELECT COUNT(*) FROM cluster_config WHERE node_name = ?", Long.class, name); }
ClusterConfigDao { public long getCountByName(String name) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); return jdbcTemplate.queryForObject( "SELECT COUNT(*) FROM cluster_config WHERE node_name = ?", Long.class, name); } }
ClusterConfigDao { public long getCountByName(String name) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); return jdbcTemplate.queryForObject( "SELECT COUNT(*) FROM cluster_config WHERE node_name = ?", Long.class, name); } ClusterConfigDao(DataSource dataSource); }
ClusterConfigDao { public long getCountByName(String name) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); return jdbcTemplate.queryForObject( "SELECT COUNT(*) FROM cluster_config WHERE node_name = ?", Long.class, name); } ClusterConfigDao(DataSource dataSource); void setDataSource(DataSource dataSource); List<ClusterConfig> getAll(); List<ClusterConfig> getByIds(List<Long> cids); ClusterConfig getById(long cid); long getCountByName(String name); ClusterConfig getByName(String name); void delete(long cid); long insert(ClusterConfig clusterConfig); void insert(ClusterConfig[] clusterConfigs); int updateById(int cid, String configPath); int updateByNodeName(String nodeName, String configPath); }
ClusterConfigDao { public long getCountByName(String name) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); return jdbcTemplate.queryForObject( "SELECT COUNT(*) FROM cluster_config WHERE node_name = ?", Long.class, name); } ClusterConfigDao(DataSource dataSource); void setDataSource(DataSource dataSource); List<ClusterConfig> getAll(); List<ClusterConfig> getByIds(List<Long> cids); ClusterConfig getById(long cid); long getCountByName(String name); ClusterConfig getByName(String name); void delete(long cid); long insert(ClusterConfig clusterConfig); void insert(ClusterConfig[] clusterConfigs); int updateById(int cid, String configPath); int updateByNodeName(String nodeName, String configPath);  }