@Test public void testUpdate() { GlobalConfig globalConfig = new GlobalConfig(); globalConfig.setCid(1); globalConfig.setPropertyName("test"); globalConfig.setPropertyValue("test1"); globalConfigDao.insert(globalConfig); globalConfigDao.update("test", "test2"); globalConfig.setPropertyValue("test2"); Assert.assertTrue(globalConfigDao.getById(1).equals(globalConfig)); }
public int update(String propertyName, String propertyValue) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String sql = "UPDATE global_config SET property_value = ? WHERE property_name = ?"; return jdbcTemplate.update(sql, propertyValue, propertyName); }
GlobalConfigDao { public int update(String propertyName, String propertyValue) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String sql = "UPDATE global_config SET property_value = ? WHERE property_name = ?"; return jdbcTemplate.update(sql, propertyValue, propertyName); } }
GlobalConfigDao { public int update(String propertyName, String propertyValue) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String sql = "UPDATE global_config SET property_value = ? WHERE property_name = ?"; return jdbcTemplate.update(sql, propertyValue, propertyName); } GlobalConfigDao(DataSource dataSource); }
GlobalConfigDao { public int update(String propertyName, String propertyValue) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String sql = "UPDATE global_config SET property_value = ? WHERE property_name = ?"; return jdbcTemplate.update(sql, propertyValue, propertyName); } GlobalConfigDao(DataSource dataSource); void setDataSource(DataSource dataSource); List<GlobalConfig> getAll(); List<GlobalConfig> getByIds(List<Long> cid); GlobalConfig getById(long cid); GlobalConfig getByPropertyName(String propertyName); void deleteByName(String propertyName); void delete(long cid); long insert(GlobalConfig globalConfig); void insert(GlobalConfig[] globalConfigs); long getCountByName(String name); int update(String propertyName, String propertyValue); }
GlobalConfigDao { public int update(String propertyName, String propertyValue) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String sql = "UPDATE global_config SET property_value = ? WHERE property_name = ?"; return jdbcTemplate.update(sql, propertyValue, propertyName); } GlobalConfigDao(DataSource dataSource); void setDataSource(DataSource dataSource); List<GlobalConfig> getAll(); List<GlobalConfig> getByIds(List<Long> cid); GlobalConfig getById(long cid); GlobalConfig getByPropertyName(String propertyName); void deleteByName(String propertyName); void delete(long cid); long insert(GlobalConfig globalConfig); void insert(GlobalConfig[] globalConfigs); long getCountByName(String name); int update(String propertyName, String propertyValue);  }