@Test public void testUpdate() { BackUpInfo backUpInfo = new BackUpInfo(); backUpInfo.setRid(1); backUpInfo.setSrc("test"); backUpInfo.setDest("test"); backUpInfo.setPeriod(1); backUpInfoDao.insert(backUpInfo); backUpInfoDao.update(1, 2); backUpInfo.setPeriod(2); Assert.assertTrue(backUpInfoDao.getByRid(1).equals(backUpInfo)); }
public int update(long rid, long period) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String sql = "UPDATE backup_file SET period = ? WHERE rid = ?"; return jdbcTemplate.update(sql, period, rid); }
BackUpInfoDao { public int update(long rid, long period) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String sql = "UPDATE backup_file SET period = ? WHERE rid = ?"; return jdbcTemplate.update(sql, period, rid); } }
BackUpInfoDao { public int update(long rid, long period) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String sql = "UPDATE backup_file SET period = ? WHERE rid = ?"; return jdbcTemplate.update(sql, period, rid); } BackUpInfoDao(DataSource dataSource); }
BackUpInfoDao { public int update(long rid, long period) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String sql = "UPDATE backup_file SET period = ? WHERE rid = ?"; return jdbcTemplate.update(sql, period, rid); } BackUpInfoDao(DataSource dataSource); void setDataSource(DataSource dataSource); List<BackUpInfo> getAll(); List<BackUpInfo> getByIds(List<Long> rids); int getCountByRid(int rid); BackUpInfo getByRid(long rid); List<BackUpInfo> getBySrc(String src); List<BackUpInfo> getByDest(String dest); void delete(long rid); void insert(BackUpInfo backUpInfo); void insert(BackUpInfo[] backUpInfos); int update(long rid, long period); void deleteAll(); }
BackUpInfoDao { public int update(long rid, long period) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String sql = "UPDATE backup_file SET period = ? WHERE rid = ?"; return jdbcTemplate.update(sql, period, rid); } BackUpInfoDao(DataSource dataSource); void setDataSource(DataSource dataSource); List<BackUpInfo> getAll(); List<BackUpInfo> getByIds(List<Long> rids); int getCountByRid(int rid); BackUpInfo getByRid(long rid); List<BackUpInfo> getBySrc(String src); List<BackUpInfo> getByDest(String dest); void delete(long rid); void insert(BackUpInfo backUpInfo); void insert(BackUpInfo[] backUpInfos); int update(long rid, long period); void deleteAll();  }