Package com.github.ambry.account.mysql
Class AccountDao
- java.lang.Object
-
- com.github.ambry.account.mysql.AccountDao
-
public class AccountDao extends java.lang.Object
Account Data Access Object.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ACCOUNT_ID
static java.lang.String
ACCOUNT_INFO
static java.lang.String
ACCOUNT_TABLE
static java.lang.String
CREATION_TIME
static java.lang.String
LAST_MODIFIED_TIME
static java.lang.String
VERSION
-
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.
-
-
-
Field Detail
-
ACCOUNT_TABLE
public static final java.lang.String ACCOUNT_TABLE
- See Also:
- Constant Field Values
-
ACCOUNT_INFO
public static final java.lang.String ACCOUNT_INFO
- See Also:
- Constant Field Values
-
VERSION
public static final java.lang.String VERSION
- See Also:
- Constant Field Values
-
CREATION_TIME
public static final java.lang.String CREATION_TIME
- See Also:
- Constant Field Values
-
LAST_MODIFIED_TIME
public static final java.lang.String LAST_MODIFIED_TIME
- See Also:
- Constant Field Values
-
ACCOUNT_ID
public static final java.lang.String ACCOUNT_ID
- See Also:
- Constant Field Values
-
-
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
Account
s. - Throws:
java.sql.SQLException
-
-