@ProviderType
public class AccountUtil
extends Object
AccountPersistenceImpl
and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class.
Caching information and settings can be found in portal.properties
AccountPersistence
,
AccountPersistenceImpl
Constructor and Description |
---|
AccountUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
cacheResult(Account account)
Caches the account in the entity cache if it is enabled.
|
static void |
cacheResult(List<Account> accounts)
Caches the accounts in the entity cache if it is enabled.
|
static void |
clearCache() |
static void |
clearCache(Account account) |
static int |
countAll()
Returns the number of accounts.
|
static long |
countWithDynamicQuery(DynamicQuery dynamicQuery) |
static Account |
create(long accountId)
Creates a new account with the primary key.
|
static Account |
fetchByPrimaryKey(long accountId)
Returns the account with the primary key or returns
null if it could not be found. |
static Map<Serializable,Account> |
fetchByPrimaryKeys(Set<Serializable> primaryKeys) |
static List<Account> |
findAll()
Returns all the accounts.
|
static List<Account> |
findAll(int start,
int end)
Returns a range of all the accounts.
|
static List<Account> |
findAll(int start,
int end,
OrderByComparator<Account> orderByComparator)
Returns an ordered range of all the accounts.
|
static List<Account> |
findAll(int start,
int end,
OrderByComparator<Account> orderByComparator,
boolean retrieveFromCache)
Returns an ordered range of all the accounts.
|
static Account |
findByPrimaryKey(long accountId)
Returns the account with the primary key or throws a
NoSuchAccountException if it could not be found. |
static List<Account> |
findWithDynamicQuery(DynamicQuery dynamicQuery) |
static List<Account> |
findWithDynamicQuery(DynamicQuery dynamicQuery,
int start,
int end) |
static List<Account> |
findWithDynamicQuery(DynamicQuery dynamicQuery,
int start,
int end,
OrderByComparator<Account> orderByComparator) |
static Set<String> |
getBadColumnNames() |
static AccountPersistence |
getPersistence() |
static Account |
remove(long accountId)
Removes the account with the primary key from the database.
|
static void |
removeAll()
Removes all the accounts from the database.
|
static Account |
update(Account account) |
static Account |
update(Account account,
ServiceContext serviceContext) |
static Account |
updateImpl(Account account) |
public static void clearCache()
BasePersistence.clearCache()
public static void clearCache(Account account)
public static long countWithDynamicQuery(DynamicQuery dynamicQuery)
public static List<Account> findWithDynamicQuery(DynamicQuery dynamicQuery)
public static List<Account> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end)
public static List<Account> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator<Account> orderByComparator)
public static Account update(Account account, ServiceContext serviceContext)
public static void cacheResult(Account account)
account
- the accountpublic static void cacheResult(List<Account> accounts)
accounts
- the accountspublic static Account create(long accountId)
accountId
- the primary key for the new accountpublic static Account remove(long accountId) throws NoSuchAccountException
accountId
- the primary key of the accountNoSuchAccountException
- if a account with the primary key could not be foundpublic static Account findByPrimaryKey(long accountId) throws NoSuchAccountException
NoSuchAccountException
if it could not be found.accountId
- the primary key of the accountNoSuchAccountException
- if a account with the primary key could not be foundpublic static Account fetchByPrimaryKey(long accountId)
null
if it could not be found.accountId
- the primary key of the accountnull
if a account with the primary key could not be foundpublic static Map<Serializable,Account> fetchByPrimaryKeys(Set<Serializable> primaryKeys)
public static List<Account> findAll()
public static List<Account> findAll(int start, int end)
Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent and pagination is required (start
and end
are not QueryUtil#ALL_POS
), then the query will include the default ORDER BY logic from AccountModelImpl
. If both orderByComparator
and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
start
- the lower bound of the range of accountsend
- the upper bound of the range of accounts (not inclusive)public static List<Account> findAll(int start, int end, OrderByComparator<Account> orderByComparator)
Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent and pagination is required (start
and end
are not QueryUtil#ALL_POS
), then the query will include the default ORDER BY logic from AccountModelImpl
. If both orderByComparator
and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
start
- the lower bound of the range of accountsend
- the upper bound of the range of accounts (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)public static List<Account> findAll(int start, int end, OrderByComparator<Account> orderByComparator, boolean retrieveFromCache)
Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent and pagination is required (start
and end
are not QueryUtil#ALL_POS
), then the query will include the default ORDER BY logic from AccountModelImpl
. If both orderByComparator
and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
start
- the lower bound of the range of accountsend
- the upper bound of the range of accounts (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)retrieveFromCache
- whether to retrieve from the finder cachepublic static void removeAll()
public static int countAll()
public static Set<String> getBadColumnNames()
public static AccountPersistence getPersistence()