001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.persistence;
016    
017    import com.liferay.portal.NoSuchAccountException;
018    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
019    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
020    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
021    import com.liferay.portal.kernel.dao.orm.FinderPath;
022    import com.liferay.portal.kernel.dao.orm.Query;
023    import com.liferay.portal.kernel.dao.orm.QueryUtil;
024    import com.liferay.portal.kernel.dao.orm.Session;
025    import com.liferay.portal.kernel.exception.SystemException;
026    import com.liferay.portal.kernel.log.Log;
027    import com.liferay.portal.kernel.log.LogFactoryUtil;
028    import com.liferay.portal.kernel.util.GetterUtil;
029    import com.liferay.portal.kernel.util.InstanceFactory;
030    import com.liferay.portal.kernel.util.OrderByComparator;
031    import com.liferay.portal.kernel.util.SetUtil;
032    import com.liferay.portal.kernel.util.StringBundler;
033    import com.liferay.portal.kernel.util.StringUtil;
034    import com.liferay.portal.kernel.util.UnmodifiableList;
035    import com.liferay.portal.model.Account;
036    import com.liferay.portal.model.CacheModel;
037    import com.liferay.portal.model.ModelListener;
038    import com.liferay.portal.model.impl.AccountImpl;
039    import com.liferay.portal.model.impl.AccountModelImpl;
040    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
041    
042    import java.io.Serializable;
043    
044    import java.util.ArrayList;
045    import java.util.Collections;
046    import java.util.List;
047    import java.util.Set;
048    
049    /**
050     * The persistence implementation for the account service.
051     *
052     * <p>
053     * Caching information and settings can be found in <code>portal.properties</code>
054     * </p>
055     *
056     * @author Brian Wing Shun Chan
057     * @see AccountPersistence
058     * @see AccountUtil
059     * @generated
060     */
061    public class AccountPersistenceImpl extends BasePersistenceImpl<Account>
062            implements AccountPersistence {
063            /*
064             * NOTE FOR DEVELOPERS:
065             *
066             * Never modify or reference this class directly. Always use {@link AccountUtil} to access the account persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
067             */
068            public static final String FINDER_CLASS_NAME_ENTITY = AccountImpl.class.getName();
069            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
070                    ".List1";
071            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
072                    ".List2";
073            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(AccountModelImpl.ENTITY_CACHE_ENABLED,
074                            AccountModelImpl.FINDER_CACHE_ENABLED, AccountImpl.class,
075                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
076            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(AccountModelImpl.ENTITY_CACHE_ENABLED,
077                            AccountModelImpl.FINDER_CACHE_ENABLED, AccountImpl.class,
078                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
079            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(AccountModelImpl.ENTITY_CACHE_ENABLED,
080                            AccountModelImpl.FINDER_CACHE_ENABLED, Long.class,
081                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
082    
083            public AccountPersistenceImpl() {
084                    setModelClass(Account.class);
085            }
086    
087            /**
088             * Caches the account in the entity cache if it is enabled.
089             *
090             * @param account the account
091             */
092            @Override
093            public void cacheResult(Account account) {
094                    EntityCacheUtil.putResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
095                            AccountImpl.class, account.getPrimaryKey(), account);
096    
097                    account.resetOriginalValues();
098            }
099    
100            /**
101             * Caches the accounts in the entity cache if it is enabled.
102             *
103             * @param accounts the accounts
104             */
105            @Override
106            public void cacheResult(List<Account> accounts) {
107                    for (Account account : accounts) {
108                            if (EntityCacheUtil.getResult(
109                                                    AccountModelImpl.ENTITY_CACHE_ENABLED,
110                                                    AccountImpl.class, account.getPrimaryKey()) == null) {
111                                    cacheResult(account);
112                            }
113                            else {
114                                    account.resetOriginalValues();
115                            }
116                    }
117            }
118    
119            /**
120             * Clears the cache for all accounts.
121             *
122             * <p>
123             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
124             * </p>
125             */
126            @Override
127            public void clearCache() {
128                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
129                            CacheRegistryUtil.clear(AccountImpl.class.getName());
130                    }
131    
132                    EntityCacheUtil.clearCache(AccountImpl.class.getName());
133    
134                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
135                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
136                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
137            }
138    
139            /**
140             * Clears the cache for the account.
141             *
142             * <p>
143             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
144             * </p>
145             */
146            @Override
147            public void clearCache(Account account) {
148                    EntityCacheUtil.removeResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
149                            AccountImpl.class, account.getPrimaryKey());
150    
151                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
152                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
153            }
154    
155            @Override
156            public void clearCache(List<Account> accounts) {
157                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
158                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
159    
160                    for (Account account : accounts) {
161                            EntityCacheUtil.removeResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
162                                    AccountImpl.class, account.getPrimaryKey());
163                    }
164            }
165    
166            /**
167             * Creates a new account with the primary key. Does not add the account to the database.
168             *
169             * @param accountId the primary key for the new account
170             * @return the new account
171             */
172            @Override
173            public Account create(long accountId) {
174                    Account account = new AccountImpl();
175    
176                    account.setNew(true);
177                    account.setPrimaryKey(accountId);
178    
179                    return account;
180            }
181    
182            /**
183             * Removes the account with the primary key from the database. Also notifies the appropriate model listeners.
184             *
185             * @param accountId the primary key of the account
186             * @return the account that was removed
187             * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found
188             * @throws SystemException if a system exception occurred
189             */
190            @Override
191            public Account remove(long accountId)
192                    throws NoSuchAccountException, SystemException {
193                    return remove((Serializable)accountId);
194            }
195    
196            /**
197             * Removes the account with the primary key from the database. Also notifies the appropriate model listeners.
198             *
199             * @param primaryKey the primary key of the account
200             * @return the account that was removed
201             * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found
202             * @throws SystemException if a system exception occurred
203             */
204            @Override
205            public Account remove(Serializable primaryKey)
206                    throws NoSuchAccountException, SystemException {
207                    Session session = null;
208    
209                    try {
210                            session = openSession();
211    
212                            Account account = (Account)session.get(AccountImpl.class, primaryKey);
213    
214                            if (account == null) {
215                                    if (_log.isWarnEnabled()) {
216                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
217                                    }
218    
219                                    throw new NoSuchAccountException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
220                                            primaryKey);
221                            }
222    
223                            return remove(account);
224                    }
225                    catch (NoSuchAccountException nsee) {
226                            throw nsee;
227                    }
228                    catch (Exception e) {
229                            throw processException(e);
230                    }
231                    finally {
232                            closeSession(session);
233                    }
234            }
235    
236            @Override
237            protected Account removeImpl(Account account) throws SystemException {
238                    account = toUnwrappedModel(account);
239    
240                    Session session = null;
241    
242                    try {
243                            session = openSession();
244    
245                            if (!session.contains(account)) {
246                                    account = (Account)session.get(AccountImpl.class,
247                                                    account.getPrimaryKeyObj());
248                            }
249    
250                            if (account != null) {
251                                    session.delete(account);
252                            }
253                    }
254                    catch (Exception e) {
255                            throw processException(e);
256                    }
257                    finally {
258                            closeSession(session);
259                    }
260    
261                    if (account != null) {
262                            clearCache(account);
263                    }
264    
265                    return account;
266            }
267    
268            @Override
269            public Account updateImpl(com.liferay.portal.model.Account account)
270                    throws SystemException {
271                    account = toUnwrappedModel(account);
272    
273                    boolean isNew = account.isNew();
274    
275                    Session session = null;
276    
277                    try {
278                            session = openSession();
279    
280                            if (account.isNew()) {
281                                    session.save(account);
282    
283                                    account.setNew(false);
284                            }
285                            else {
286                                    session.merge(account);
287                            }
288                    }
289                    catch (Exception e) {
290                            throw processException(e);
291                    }
292                    finally {
293                            closeSession(session);
294                    }
295    
296                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
297    
298                    if (isNew) {
299                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
300                    }
301    
302                    EntityCacheUtil.putResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
303                            AccountImpl.class, account.getPrimaryKey(), account);
304    
305                    return account;
306            }
307    
308            protected Account toUnwrappedModel(Account account) {
309                    if (account instanceof AccountImpl) {
310                            return account;
311                    }
312    
313                    AccountImpl accountImpl = new AccountImpl();
314    
315                    accountImpl.setNew(account.isNew());
316                    accountImpl.setPrimaryKey(account.getPrimaryKey());
317    
318                    accountImpl.setAccountId(account.getAccountId());
319                    accountImpl.setCompanyId(account.getCompanyId());
320                    accountImpl.setUserId(account.getUserId());
321                    accountImpl.setUserName(account.getUserName());
322                    accountImpl.setCreateDate(account.getCreateDate());
323                    accountImpl.setModifiedDate(account.getModifiedDate());
324                    accountImpl.setParentAccountId(account.getParentAccountId());
325                    accountImpl.setName(account.getName());
326                    accountImpl.setLegalName(account.getLegalName());
327                    accountImpl.setLegalId(account.getLegalId());
328                    accountImpl.setLegalType(account.getLegalType());
329                    accountImpl.setSicCode(account.getSicCode());
330                    accountImpl.setTickerSymbol(account.getTickerSymbol());
331                    accountImpl.setIndustry(account.getIndustry());
332                    accountImpl.setType(account.getType());
333                    accountImpl.setSize(account.getSize());
334    
335                    return accountImpl;
336            }
337    
338            /**
339             * Returns the account with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
340             *
341             * @param primaryKey the primary key of the account
342             * @return the account
343             * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found
344             * @throws SystemException if a system exception occurred
345             */
346            @Override
347            public Account findByPrimaryKey(Serializable primaryKey)
348                    throws NoSuchAccountException, SystemException {
349                    Account account = fetchByPrimaryKey(primaryKey);
350    
351                    if (account == null) {
352                            if (_log.isWarnEnabled()) {
353                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
354                            }
355    
356                            throw new NoSuchAccountException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
357                                    primaryKey);
358                    }
359    
360                    return account;
361            }
362    
363            /**
364             * Returns the account with the primary key or throws a {@link com.liferay.portal.NoSuchAccountException} if it could not be found.
365             *
366             * @param accountId the primary key of the account
367             * @return the account
368             * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found
369             * @throws SystemException if a system exception occurred
370             */
371            @Override
372            public Account findByPrimaryKey(long accountId)
373                    throws NoSuchAccountException, SystemException {
374                    return findByPrimaryKey((Serializable)accountId);
375            }
376    
377            /**
378             * Returns the account with the primary key or returns <code>null</code> if it could not be found.
379             *
380             * @param primaryKey the primary key of the account
381             * @return the account, or <code>null</code> if a account with the primary key could not be found
382             * @throws SystemException if a system exception occurred
383             */
384            @Override
385            public Account fetchByPrimaryKey(Serializable primaryKey)
386                    throws SystemException {
387                    Account account = (Account)EntityCacheUtil.getResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
388                                    AccountImpl.class, primaryKey);
389    
390                    if (account == _nullAccount) {
391                            return null;
392                    }
393    
394                    if (account == null) {
395                            Session session = null;
396    
397                            try {
398                                    session = openSession();
399    
400                                    account = (Account)session.get(AccountImpl.class, primaryKey);
401    
402                                    if (account != null) {
403                                            cacheResult(account);
404                                    }
405                                    else {
406                                            EntityCacheUtil.putResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
407                                                    AccountImpl.class, primaryKey, _nullAccount);
408                                    }
409                            }
410                            catch (Exception e) {
411                                    EntityCacheUtil.removeResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
412                                            AccountImpl.class, primaryKey);
413    
414                                    throw processException(e);
415                            }
416                            finally {
417                                    closeSession(session);
418                            }
419                    }
420    
421                    return account;
422            }
423    
424            /**
425             * Returns the account with the primary key or returns <code>null</code> if it could not be found.
426             *
427             * @param accountId the primary key of the account
428             * @return the account, or <code>null</code> if a account with the primary key could not be found
429             * @throws SystemException if a system exception occurred
430             */
431            @Override
432            public Account fetchByPrimaryKey(long accountId) throws SystemException {
433                    return fetchByPrimaryKey((Serializable)accountId);
434            }
435    
436            /**
437             * Returns all the accounts.
438             *
439             * @return the accounts
440             * @throws SystemException if a system exception occurred
441             */
442            @Override
443            public List<Account> findAll() throws SystemException {
444                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
445            }
446    
447            /**
448             * Returns a range of all the accounts.
449             *
450             * <p>
451             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.AccountModelImpl}. If both <code>orderByComparator</code> 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.
452             * </p>
453             *
454             * @param start the lower bound of the range of accounts
455             * @param end the upper bound of the range of accounts (not inclusive)
456             * @return the range of accounts
457             * @throws SystemException if a system exception occurred
458             */
459            @Override
460            public List<Account> findAll(int start, int end) throws SystemException {
461                    return findAll(start, end, null);
462            }
463    
464            /**
465             * Returns an ordered range of all the accounts.
466             *
467             * <p>
468             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.AccountModelImpl}. If both <code>orderByComparator</code> 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.
469             * </p>
470             *
471             * @param start the lower bound of the range of accounts
472             * @param end the upper bound of the range of accounts (not inclusive)
473             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
474             * @return the ordered range of accounts
475             * @throws SystemException if a system exception occurred
476             */
477            @Override
478            public List<Account> findAll(int start, int end,
479                    OrderByComparator orderByComparator) throws SystemException {
480                    boolean pagination = true;
481                    FinderPath finderPath = null;
482                    Object[] finderArgs = null;
483    
484                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
485                                    (orderByComparator == null)) {
486                            pagination = false;
487                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
488                            finderArgs = FINDER_ARGS_EMPTY;
489                    }
490                    else {
491                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
492                            finderArgs = new Object[] { start, end, orderByComparator };
493                    }
494    
495                    List<Account> list = (List<Account>)FinderCacheUtil.getResult(finderPath,
496                                    finderArgs, this);
497    
498                    if (list == null) {
499                            StringBundler query = null;
500                            String sql = null;
501    
502                            if (orderByComparator != null) {
503                                    query = new StringBundler(2 +
504                                                    (orderByComparator.getOrderByFields().length * 3));
505    
506                                    query.append(_SQL_SELECT_ACCOUNT);
507    
508                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
509                                            orderByComparator);
510    
511                                    sql = query.toString();
512                            }
513                            else {
514                                    sql = _SQL_SELECT_ACCOUNT;
515    
516                                    if (pagination) {
517                                            sql = sql.concat(AccountModelImpl.ORDER_BY_JPQL);
518                                    }
519                            }
520    
521                            Session session = null;
522    
523                            try {
524                                    session = openSession();
525    
526                                    Query q = session.createQuery(sql);
527    
528                                    if (!pagination) {
529                                            list = (List<Account>)QueryUtil.list(q, getDialect(),
530                                                            start, end, false);
531    
532                                            Collections.sort(list);
533    
534                                            list = new UnmodifiableList<Account>(list);
535                                    }
536                                    else {
537                                            list = (List<Account>)QueryUtil.list(q, getDialect(),
538                                                            start, end);
539                                    }
540    
541                                    cacheResult(list);
542    
543                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
544                            }
545                            catch (Exception e) {
546                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
547    
548                                    throw processException(e);
549                            }
550                            finally {
551                                    closeSession(session);
552                            }
553                    }
554    
555                    return list;
556            }
557    
558            /**
559             * Removes all the accounts from the database.
560             *
561             * @throws SystemException if a system exception occurred
562             */
563            @Override
564            public void removeAll() throws SystemException {
565                    for (Account account : findAll()) {
566                            remove(account);
567                    }
568            }
569    
570            /**
571             * Returns the number of accounts.
572             *
573             * @return the number of accounts
574             * @throws SystemException if a system exception occurred
575             */
576            @Override
577            public int countAll() throws SystemException {
578                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
579                                    FINDER_ARGS_EMPTY, this);
580    
581                    if (count == null) {
582                            Session session = null;
583    
584                            try {
585                                    session = openSession();
586    
587                                    Query q = session.createQuery(_SQL_COUNT_ACCOUNT);
588    
589                                    count = (Long)q.uniqueResult();
590    
591                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
592                                            FINDER_ARGS_EMPTY, count);
593                            }
594                            catch (Exception e) {
595                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
596                                            FINDER_ARGS_EMPTY);
597    
598                                    throw processException(e);
599                            }
600                            finally {
601                                    closeSession(session);
602                            }
603                    }
604    
605                    return count.intValue();
606            }
607    
608            @Override
609            protected Set<String> getBadColumnNames() {
610                    return _badColumnNames;
611            }
612    
613            /**
614             * Initializes the account persistence.
615             */
616            public void afterPropertiesSet() {
617                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
618                                            com.liferay.portal.util.PropsUtil.get(
619                                                    "value.object.listener.com.liferay.portal.model.Account")));
620    
621                    if (listenerClassNames.length > 0) {
622                            try {
623                                    List<ModelListener<Account>> listenersList = new ArrayList<ModelListener<Account>>();
624    
625                                    for (String listenerClassName : listenerClassNames) {
626                                            listenersList.add((ModelListener<Account>)InstanceFactory.newInstance(
627                                                            getClassLoader(), listenerClassName));
628                                    }
629    
630                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
631                            }
632                            catch (Exception e) {
633                                    _log.error(e);
634                            }
635                    }
636            }
637    
638            public void destroy() {
639                    EntityCacheUtil.removeCache(AccountImpl.class.getName());
640                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
641                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
642                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
643            }
644    
645            private static final String _SQL_SELECT_ACCOUNT = "SELECT account FROM Account account";
646            private static final String _SQL_COUNT_ACCOUNT = "SELECT COUNT(account) FROM Account account";
647            private static final String _ORDER_BY_ENTITY_ALIAS = "account.";
648            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Account exists with the primary key ";
649            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
650            private static Log _log = LogFactoryUtil.getLog(AccountPersistenceImpl.class);
651            private static Set<String> _badColumnNames = SetUtil.fromArray(new String[] {
652                                    "type", "size"
653                            });
654            private static Account _nullAccount = new AccountImpl() {
655                            @Override
656                            public Object clone() {
657                                    return this;
658                            }
659    
660                            @Override
661                            public CacheModel<Account> toCacheModel() {
662                                    return _nullAccountCacheModel;
663                            }
664                    };
665    
666            private static CacheModel<Account> _nullAccountCacheModel = new CacheModel<Account>() {
667                            @Override
668                            public Account toEntityModel() {
669                                    return _nullAccount;
670                            }
671                    };
672    }