Class AccountDao


  • public class AccountDao
    extends java.lang.Object
    Account Data Access Object.
    • Constructor Summary

      Constructors 
      Constructor Description
      AccountDao​(com.github.ambry.mysql.MySqlDataAccessor dataAccessor)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAccount​(com.github.ambry.account.Account account)
      Add an account to the database.
      void addAccounts​(java.util.Collection<com.github.ambry.account.Account> accounts, int batchSize)
      Add accounts to the database in batches.
      java.util.List<com.github.ambry.account.Account> getNewAccounts​(long updatedSince)
      Gets all accounts that have been created or modified since the specified time.
      void updateAccount​(com.github.ambry.account.Account account)
      Updates an existing account in the database.
      void updateAccounts​(java.util.Collection<com.github.ambry.account.Account> accounts, int batchSize)
      Updates a collection of accounts in the database.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AccountDao

        public AccountDao​(com.github.ambry.mysql.MySqlDataAccessor dataAccessor)
    • Method Detail

      • addAccount

        public void addAccount​(com.github.ambry.account.Account account)
                        throws java.sql.SQLException
        Add an account to the database.
        Parameters:
        account - the account to insert.
        Throws:
        java.sql.SQLException
      • addAccounts

        public void addAccounts​(java.util.Collection<com.github.ambry.account.Account> accounts,
                                int batchSize)
                         throws java.sql.SQLException
        Add accounts to the database in batches.
        Parameters:
        accounts - the account to insert.
        batchSize - number of statements to be executed in one batch
        Throws:
        java.sql.SQLException
      • updateAccount

        public void updateAccount​(com.github.ambry.account.Account account)
                           throws java.sql.SQLException
        Updates an existing account in the database.
        Parameters:
        account - the account to update.
        Throws:
        java.sql.SQLException
      • updateAccounts

        public void updateAccounts​(java.util.Collection<com.github.ambry.account.Account> accounts,
                                   int batchSize)
                            throws java.sql.SQLException
        Updates a collection of accounts in the database.
        Parameters:
        accounts - the account to update.
        batchSize - number of statements to be executed in one batch
        Throws:
        java.sql.SQLException
      • getNewAccounts

        public java.util.List<com.github.ambry.account.Account> getNewAccounts​(long updatedSince)
                                                                        throws java.sql.SQLException
        Gets all accounts that have been created or modified since the specified time.
        Parameters:
        updatedSince - the last modified time used to filter.
        Returns:
        a list of Accounts.
        Throws:
        java.sql.SQLException