@Test public void testUpdate() { SystemInfo systemInfo = new SystemInfo("test", "test"); systemInfoDao.insert(systemInfo); SystemInfo newSystemInfo = new SystemInfo("test", "test1"); systemInfoDao.update(newSystemInfo); Assert.assertTrue(systemInfoDao.getByProperty("test").equals(newSystemInfo)); }
public int update(SystemInfo systemInfo) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String sql = "UPDATE " + TABLE_NAME + " SET value = ? WHERE property = ?"; return jdbcTemplate.update(sql, systemInfo.getValue(), systemInfo.getProperty()); }
SystemInfoDao { public int update(SystemInfo systemInfo) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String sql = "UPDATE " + TABLE_NAME + " SET value = ? WHERE property = ?"; return jdbcTemplate.update(sql, systemInfo.getValue(), systemInfo.getProperty()); } }
SystemInfoDao { public int update(SystemInfo systemInfo) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String sql = "UPDATE " + TABLE_NAME + " SET value = ? WHERE property = ?"; return jdbcTemplate.update(sql, systemInfo.getValue(), systemInfo.getProperty()); } SystemInfoDao(DataSource dataSource); }
SystemInfoDao { public int update(SystemInfo systemInfo) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String sql = "UPDATE " + TABLE_NAME + " SET value = ? WHERE property = ?"; return jdbcTemplate.update(sql, systemInfo.getValue(), systemInfo.getProperty()); } SystemInfoDao(DataSource dataSource); void setDataSource(DataSource dataSource); List<SystemInfo> getAll(); boolean containsProperty(String property); SystemInfo getByProperty(String property); List<SystemInfo> getByProperties(List<String> properties); void delete(String property); void insert(SystemInfo systemInfo); void insert(SystemInfo[] systemInfos); int update(SystemInfo systemInfo); void deleteAll(); }
SystemInfoDao { public int update(SystemInfo systemInfo) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String sql = "UPDATE " + TABLE_NAME + " SET value = ? WHERE property = ?"; return jdbcTemplate.update(sql, systemInfo.getValue(), systemInfo.getProperty()); } SystemInfoDao(DataSource dataSource); void setDataSource(DataSource dataSource); List<SystemInfo> getAll(); boolean containsProperty(String property); SystemInfo getByProperty(String property); List<SystemInfo> getByProperties(List<String> properties); void delete(String property); void insert(SystemInfo systemInfo); void insert(SystemInfo[] systemInfos); int update(SystemInfo systemInfo); void deleteAll();  }