@Test public void testGetAccounts() throws Exception { List<Account> accountList = accountDao.getNewAccounts(0L); assertEquals(1, accountList.size()); assertEquals(testAccount, accountList.get(0)); }
public List<Account> getNewAccounts(long updatedSince) throws SQLException { Timestamp sinceTime = new Timestamp(updatedSince); PreparedStatement getSinceStatement = dataAccessor.getPreparedStatement(getSinceSql); getSinceStatement.setTimestamp(1, sinceTime); try (ResultSet rs = getSinceStatement.executeQuery()) { return convertResultSet(rs); } catch (SQLException e) { dataAccessor.reset(); throw e; } }
AccountDao { public List<Account> getNewAccounts(long updatedSince) throws SQLException { Timestamp sinceTime = new Timestamp(updatedSince); PreparedStatement getSinceStatement = dataAccessor.getPreparedStatement(getSinceSql); getSinceStatement.setTimestamp(1, sinceTime); try (ResultSet rs = getSinceStatement.executeQuery()) { return convertResultSet(rs); } catch (SQLException e) { dataAccessor.reset(); throw e; } } }
AccountDao { public List<Account> getNewAccounts(long updatedSince) throws SQLException { Timestamp sinceTime = new Timestamp(updatedSince); PreparedStatement getSinceStatement = dataAccessor.getPreparedStatement(getSinceSql); getSinceStatement.setTimestamp(1, sinceTime); try (ResultSet rs = getSinceStatement.executeQuery()) { return convertResultSet(rs); } catch (SQLException e) { dataAccessor.reset(); throw e; } } AccountDao(MySqlDataAccessor dataAccessor); }
AccountDao { public List<Account> getNewAccounts(long updatedSince) throws SQLException { Timestamp sinceTime = new Timestamp(updatedSince); PreparedStatement getSinceStatement = dataAccessor.getPreparedStatement(getSinceSql); getSinceStatement.setTimestamp(1, sinceTime); try (ResultSet rs = getSinceStatement.executeQuery()) { return convertResultSet(rs); } catch (SQLException e) { dataAccessor.reset(); throw e; } } AccountDao(MySqlDataAccessor dataAccessor); void addAccount(Account account); List<Account> getNewAccounts(long updatedSince); void updateAccount(Account account); }
AccountDao { public List<Account> getNewAccounts(long updatedSince) throws SQLException { Timestamp sinceTime = new Timestamp(updatedSince); PreparedStatement getSinceStatement = dataAccessor.getPreparedStatement(getSinceSql); getSinceStatement.setTimestamp(1, sinceTime); try (ResultSet rs = getSinceStatement.executeQuery()) { return convertResultSet(rs); } catch (SQLException e) { dataAccessor.reset(); throw e; } } AccountDao(MySqlDataAccessor dataAccessor); void addAccount(Account account); List<Account> getNewAccounts(long updatedSince); void updateAccount(Account account); static final String ACCOUNT_TABLE; static final String ACCOUNT_INFO; static final String VERSION; static final String CREATION_TIME; static final String LAST_MODIFIED_TIME; static final String ACCOUNT_ID; }