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.NoSuchModelException;
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023    import com.liferay.portal.kernel.dao.orm.FinderPath;
024    import com.liferay.portal.kernel.dao.orm.Query;
025    import com.liferay.portal.kernel.dao.orm.QueryUtil;
026    import com.liferay.portal.kernel.dao.orm.Session;
027    import com.liferay.portal.kernel.exception.SystemException;
028    import com.liferay.portal.kernel.log.Log;
029    import com.liferay.portal.kernel.log.LogFactoryUtil;
030    import com.liferay.portal.kernel.util.GetterUtil;
031    import com.liferay.portal.kernel.util.InstanceFactory;
032    import com.liferay.portal.kernel.util.OrderByComparator;
033    import com.liferay.portal.kernel.util.StringBundler;
034    import com.liferay.portal.kernel.util.StringUtil;
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    
048    /**
049     * The persistence implementation for the account service.
050     *
051     * <p>
052     * Caching information and settings can be found in <code>portal.properties</code>
053     * </p>
054     *
055     * @author Brian Wing Shun Chan
056     * @see AccountPersistence
057     * @see AccountUtil
058     * @generated
059     */
060    public class AccountPersistenceImpl extends BasePersistenceImpl<Account>
061            implements AccountPersistence {
062            /*
063             * NOTE FOR DEVELOPERS:
064             *
065             * 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.
066             */
067            public static final String FINDER_CLASS_NAME_ENTITY = AccountImpl.class.getName();
068            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
069                    ".List1";
070            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
071                    ".List2";
072            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(AccountModelImpl.ENTITY_CACHE_ENABLED,
073                            AccountModelImpl.FINDER_CACHE_ENABLED, AccountImpl.class,
074                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
075            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(AccountModelImpl.ENTITY_CACHE_ENABLED,
076                            AccountModelImpl.FINDER_CACHE_ENABLED, AccountImpl.class,
077                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
078            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(AccountModelImpl.ENTITY_CACHE_ENABLED,
079                            AccountModelImpl.FINDER_CACHE_ENABLED, Long.class,
080                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
081    
082            /**
083             * Caches the account in the entity cache if it is enabled.
084             *
085             * @param account the account
086             */
087            public void cacheResult(Account account) {
088                    EntityCacheUtil.putResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
089                            AccountImpl.class, account.getPrimaryKey(), account);
090    
091                    account.resetOriginalValues();
092            }
093    
094            /**
095             * Caches the accounts in the entity cache if it is enabled.
096             *
097             * @param accounts the accounts
098             */
099            public void cacheResult(List<Account> accounts) {
100                    for (Account account : accounts) {
101                            if (EntityCacheUtil.getResult(
102                                                    AccountModelImpl.ENTITY_CACHE_ENABLED,
103                                                    AccountImpl.class, account.getPrimaryKey()) == null) {
104                                    cacheResult(account);
105                            }
106                            else {
107                                    account.resetOriginalValues();
108                            }
109                    }
110            }
111    
112            /**
113             * Clears the cache for all accounts.
114             *
115             * <p>
116             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
117             * </p>
118             */
119            @Override
120            public void clearCache() {
121                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
122                            CacheRegistryUtil.clear(AccountImpl.class.getName());
123                    }
124    
125                    EntityCacheUtil.clearCache(AccountImpl.class.getName());
126    
127                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
128                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
129                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
130            }
131    
132            /**
133             * Clears the cache for the account.
134             *
135             * <p>
136             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
137             * </p>
138             */
139            @Override
140            public void clearCache(Account account) {
141                    EntityCacheUtil.removeResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
142                            AccountImpl.class, account.getPrimaryKey());
143    
144                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
145                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
146            }
147    
148            @Override
149            public void clearCache(List<Account> accounts) {
150                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
151                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
152    
153                    for (Account account : accounts) {
154                            EntityCacheUtil.removeResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
155                                    AccountImpl.class, account.getPrimaryKey());
156                    }
157            }
158    
159            /**
160             * Creates a new account with the primary key. Does not add the account to the database.
161             *
162             * @param accountId the primary key for the new account
163             * @return the new account
164             */
165            public Account create(long accountId) {
166                    Account account = new AccountImpl();
167    
168                    account.setNew(true);
169                    account.setPrimaryKey(accountId);
170    
171                    return account;
172            }
173    
174            /**
175             * Removes the account with the primary key from the database. Also notifies the appropriate model listeners.
176             *
177             * @param accountId the primary key of the account
178             * @return the account that was removed
179             * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found
180             * @throws SystemException if a system exception occurred
181             */
182            public Account remove(long accountId)
183                    throws NoSuchAccountException, SystemException {
184                    return remove(Long.valueOf(accountId));
185            }
186    
187            /**
188             * Removes the account with the primary key from the database. Also notifies the appropriate model listeners.
189             *
190             * @param primaryKey the primary key of the account
191             * @return the account that was removed
192             * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found
193             * @throws SystemException if a system exception occurred
194             */
195            @Override
196            public Account remove(Serializable primaryKey)
197                    throws NoSuchAccountException, SystemException {
198                    Session session = null;
199    
200                    try {
201                            session = openSession();
202    
203                            Account account = (Account)session.get(AccountImpl.class, primaryKey);
204    
205                            if (account == null) {
206                                    if (_log.isWarnEnabled()) {
207                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
208                                    }
209    
210                                    throw new NoSuchAccountException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
211                                            primaryKey);
212                            }
213    
214                            return remove(account);
215                    }
216                    catch (NoSuchAccountException nsee) {
217                            throw nsee;
218                    }
219                    catch (Exception e) {
220                            throw processException(e);
221                    }
222                    finally {
223                            closeSession(session);
224                    }
225            }
226    
227            @Override
228            protected Account removeImpl(Account account) throws SystemException {
229                    account = toUnwrappedModel(account);
230    
231                    Session session = null;
232    
233                    try {
234                            session = openSession();
235    
236                            BatchSessionUtil.delete(session, account);
237                    }
238                    catch (Exception e) {
239                            throw processException(e);
240                    }
241                    finally {
242                            closeSession(session);
243                    }
244    
245                    clearCache(account);
246    
247                    return account;
248            }
249    
250            @Override
251            public Account updateImpl(com.liferay.portal.model.Account account,
252                    boolean merge) throws SystemException {
253                    account = toUnwrappedModel(account);
254    
255                    boolean isNew = account.isNew();
256    
257                    Session session = null;
258    
259                    try {
260                            session = openSession();
261    
262                            BatchSessionUtil.update(session, account, merge);
263    
264                            account.setNew(false);
265                    }
266                    catch (Exception e) {
267                            throw processException(e);
268                    }
269                    finally {
270                            closeSession(session);
271                    }
272    
273                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
274    
275                    if (isNew) {
276                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
277                    }
278    
279                    EntityCacheUtil.putResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
280                            AccountImpl.class, account.getPrimaryKey(), account);
281    
282                    return account;
283            }
284    
285            protected Account toUnwrappedModel(Account account) {
286                    if (account instanceof AccountImpl) {
287                            return account;
288                    }
289    
290                    AccountImpl accountImpl = new AccountImpl();
291    
292                    accountImpl.setNew(account.isNew());
293                    accountImpl.setPrimaryKey(account.getPrimaryKey());
294    
295                    accountImpl.setAccountId(account.getAccountId());
296                    accountImpl.setCompanyId(account.getCompanyId());
297                    accountImpl.setUserId(account.getUserId());
298                    accountImpl.setUserName(account.getUserName());
299                    accountImpl.setCreateDate(account.getCreateDate());
300                    accountImpl.setModifiedDate(account.getModifiedDate());
301                    accountImpl.setParentAccountId(account.getParentAccountId());
302                    accountImpl.setName(account.getName());
303                    accountImpl.setLegalName(account.getLegalName());
304                    accountImpl.setLegalId(account.getLegalId());
305                    accountImpl.setLegalType(account.getLegalType());
306                    accountImpl.setSicCode(account.getSicCode());
307                    accountImpl.setTickerSymbol(account.getTickerSymbol());
308                    accountImpl.setIndustry(account.getIndustry());
309                    accountImpl.setType(account.getType());
310                    accountImpl.setSize(account.getSize());
311    
312                    return accountImpl;
313            }
314    
315            /**
316             * Returns the account with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
317             *
318             * @param primaryKey the primary key of the account
319             * @return the account
320             * @throws com.liferay.portal.NoSuchModelException if a account with the primary key could not be found
321             * @throws SystemException if a system exception occurred
322             */
323            @Override
324            public Account findByPrimaryKey(Serializable primaryKey)
325                    throws NoSuchModelException, SystemException {
326                    return findByPrimaryKey(((Long)primaryKey).longValue());
327            }
328    
329            /**
330             * Returns the account with the primary key or throws a {@link com.liferay.portal.NoSuchAccountException} if it could not be found.
331             *
332             * @param accountId the primary key of the account
333             * @return the account
334             * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found
335             * @throws SystemException if a system exception occurred
336             */
337            public Account findByPrimaryKey(long accountId)
338                    throws NoSuchAccountException, SystemException {
339                    Account account = fetchByPrimaryKey(accountId);
340    
341                    if (account == null) {
342                            if (_log.isWarnEnabled()) {
343                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + accountId);
344                            }
345    
346                            throw new NoSuchAccountException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
347                                    accountId);
348                    }
349    
350                    return account;
351            }
352    
353            /**
354             * Returns the account with the primary key or returns <code>null</code> if it could not be found.
355             *
356             * @param primaryKey the primary key of the account
357             * @return the account, or <code>null</code> if a account with the primary key could not be found
358             * @throws SystemException if a system exception occurred
359             */
360            @Override
361            public Account fetchByPrimaryKey(Serializable primaryKey)
362                    throws SystemException {
363                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
364            }
365    
366            /**
367             * Returns the account with the primary key or returns <code>null</code> if it could not be found.
368             *
369             * @param accountId the primary key of the account
370             * @return the account, or <code>null</code> if a account with the primary key could not be found
371             * @throws SystemException if a system exception occurred
372             */
373            public Account fetchByPrimaryKey(long accountId) throws SystemException {
374                    Account account = (Account)EntityCacheUtil.getResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
375                                    AccountImpl.class, accountId);
376    
377                    if (account == _nullAccount) {
378                            return null;
379                    }
380    
381                    if (account == null) {
382                            Session session = null;
383    
384                            boolean hasException = false;
385    
386                            try {
387                                    session = openSession();
388    
389                                    account = (Account)session.get(AccountImpl.class,
390                                                    Long.valueOf(accountId));
391                            }
392                            catch (Exception e) {
393                                    hasException = true;
394    
395                                    throw processException(e);
396                            }
397                            finally {
398                                    if (account != null) {
399                                            cacheResult(account);
400                                    }
401                                    else if (!hasException) {
402                                            EntityCacheUtil.putResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
403                                                    AccountImpl.class, accountId, _nullAccount);
404                                    }
405    
406                                    closeSession(session);
407                            }
408                    }
409    
410                    return account;
411            }
412    
413            /**
414             * Returns all the accounts.
415             *
416             * @return the accounts
417             * @throws SystemException if a system exception occurred
418             */
419            public List<Account> findAll() throws SystemException {
420                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
421            }
422    
423            /**
424             * Returns a range of all the accounts.
425             *
426             * <p>
427             * 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.
428             * </p>
429             *
430             * @param start the lower bound of the range of accounts
431             * @param end the upper bound of the range of accounts (not inclusive)
432             * @return the range of accounts
433             * @throws SystemException if a system exception occurred
434             */
435            public List<Account> findAll(int start, int end) throws SystemException {
436                    return findAll(start, end, null);
437            }
438    
439            /**
440             * Returns an ordered range of all the accounts.
441             *
442             * <p>
443             * 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.
444             * </p>
445             *
446             * @param start the lower bound of the range of accounts
447             * @param end the upper bound of the range of accounts (not inclusive)
448             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
449             * @return the ordered range of accounts
450             * @throws SystemException if a system exception occurred
451             */
452            public List<Account> findAll(int start, int end,
453                    OrderByComparator orderByComparator) throws SystemException {
454                    FinderPath finderPath = null;
455                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
456    
457                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
458                                    (orderByComparator == null)) {
459                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
460                            finderArgs = FINDER_ARGS_EMPTY;
461                    }
462                    else {
463                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
464                            finderArgs = new Object[] { start, end, orderByComparator };
465                    }
466    
467                    List<Account> list = (List<Account>)FinderCacheUtil.getResult(finderPath,
468                                    finderArgs, this);
469    
470                    if (list == null) {
471                            StringBundler query = null;
472                            String sql = null;
473    
474                            if (orderByComparator != null) {
475                                    query = new StringBundler(2 +
476                                                    (orderByComparator.getOrderByFields().length * 3));
477    
478                                    query.append(_SQL_SELECT_ACCOUNT);
479    
480                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
481                                            orderByComparator);
482    
483                                    sql = query.toString();
484                            }
485                            else {
486                                    sql = _SQL_SELECT_ACCOUNT;
487                            }
488    
489                            Session session = null;
490    
491                            try {
492                                    session = openSession();
493    
494                                    Query q = session.createQuery(sql);
495    
496                                    if (orderByComparator == null) {
497                                            list = (List<Account>)QueryUtil.list(q, getDialect(),
498                                                            start, end, false);
499    
500                                            Collections.sort(list);
501                                    }
502                                    else {
503                                            list = (List<Account>)QueryUtil.list(q, getDialect(),
504                                                            start, end);
505                                    }
506                            }
507                            catch (Exception e) {
508                                    throw processException(e);
509                            }
510                            finally {
511                                    if (list == null) {
512                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
513                                    }
514                                    else {
515                                            cacheResult(list);
516    
517                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
518                                    }
519    
520                                    closeSession(session);
521                            }
522                    }
523    
524                    return list;
525            }
526    
527            /**
528             * Removes all the accounts from the database.
529             *
530             * @throws SystemException if a system exception occurred
531             */
532            public void removeAll() throws SystemException {
533                    for (Account account : findAll()) {
534                            remove(account);
535                    }
536            }
537    
538            /**
539             * Returns the number of accounts.
540             *
541             * @return the number of accounts
542             * @throws SystemException if a system exception occurred
543             */
544            public int countAll() throws SystemException {
545                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
546                                    FINDER_ARGS_EMPTY, this);
547    
548                    if (count == null) {
549                            Session session = null;
550    
551                            try {
552                                    session = openSession();
553    
554                                    Query q = session.createQuery(_SQL_COUNT_ACCOUNT);
555    
556                                    count = (Long)q.uniqueResult();
557                            }
558                            catch (Exception e) {
559                                    throw processException(e);
560                            }
561                            finally {
562                                    if (count == null) {
563                                            count = Long.valueOf(0);
564                                    }
565    
566                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
567                                            FINDER_ARGS_EMPTY, count);
568    
569                                    closeSession(session);
570                            }
571                    }
572    
573                    return count.intValue();
574            }
575    
576            /**
577             * Initializes the account persistence.
578             */
579            public void afterPropertiesSet() {
580                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
581                                            com.liferay.portal.util.PropsUtil.get(
582                                                    "value.object.listener.com.liferay.portal.model.Account")));
583    
584                    if (listenerClassNames.length > 0) {
585                            try {
586                                    List<ModelListener<Account>> listenersList = new ArrayList<ModelListener<Account>>();
587    
588                                    for (String listenerClassName : listenerClassNames) {
589                                            Class<?> clazz = getClass();
590    
591                                            listenersList.add((ModelListener<Account>)InstanceFactory.newInstance(
592                                                            clazz.getClassLoader(), listenerClassName));
593                                    }
594    
595                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
596                            }
597                            catch (Exception e) {
598                                    _log.error(e);
599                            }
600                    }
601            }
602    
603            public void destroy() {
604                    EntityCacheUtil.removeCache(AccountImpl.class.getName());
605                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
606                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
607            }
608    
609            @BeanReference(type = AccountPersistence.class)
610            protected AccountPersistence accountPersistence;
611            @BeanReference(type = AddressPersistence.class)
612            protected AddressPersistence addressPersistence;
613            @BeanReference(type = BrowserTrackerPersistence.class)
614            protected BrowserTrackerPersistence browserTrackerPersistence;
615            @BeanReference(type = ClassNamePersistence.class)
616            protected ClassNamePersistence classNamePersistence;
617            @BeanReference(type = ClusterGroupPersistence.class)
618            protected ClusterGroupPersistence clusterGroupPersistence;
619            @BeanReference(type = CompanyPersistence.class)
620            protected CompanyPersistence companyPersistence;
621            @BeanReference(type = ContactPersistence.class)
622            protected ContactPersistence contactPersistence;
623            @BeanReference(type = CountryPersistence.class)
624            protected CountryPersistence countryPersistence;
625            @BeanReference(type = EmailAddressPersistence.class)
626            protected EmailAddressPersistence emailAddressPersistence;
627            @BeanReference(type = GroupPersistence.class)
628            protected GroupPersistence groupPersistence;
629            @BeanReference(type = ImagePersistence.class)
630            protected ImagePersistence imagePersistence;
631            @BeanReference(type = LayoutPersistence.class)
632            protected LayoutPersistence layoutPersistence;
633            @BeanReference(type = LayoutBranchPersistence.class)
634            protected LayoutBranchPersistence layoutBranchPersistence;
635            @BeanReference(type = LayoutPrototypePersistence.class)
636            protected LayoutPrototypePersistence layoutPrototypePersistence;
637            @BeanReference(type = LayoutRevisionPersistence.class)
638            protected LayoutRevisionPersistence layoutRevisionPersistence;
639            @BeanReference(type = LayoutSetPersistence.class)
640            protected LayoutSetPersistence layoutSetPersistence;
641            @BeanReference(type = LayoutSetBranchPersistence.class)
642            protected LayoutSetBranchPersistence layoutSetBranchPersistence;
643            @BeanReference(type = LayoutSetPrototypePersistence.class)
644            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
645            @BeanReference(type = ListTypePersistence.class)
646            protected ListTypePersistence listTypePersistence;
647            @BeanReference(type = LockPersistence.class)
648            protected LockPersistence lockPersistence;
649            @BeanReference(type = MembershipRequestPersistence.class)
650            protected MembershipRequestPersistence membershipRequestPersistence;
651            @BeanReference(type = OrganizationPersistence.class)
652            protected OrganizationPersistence organizationPersistence;
653            @BeanReference(type = OrgGroupPermissionPersistence.class)
654            protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
655            @BeanReference(type = OrgGroupRolePersistence.class)
656            protected OrgGroupRolePersistence orgGroupRolePersistence;
657            @BeanReference(type = OrgLaborPersistence.class)
658            protected OrgLaborPersistence orgLaborPersistence;
659            @BeanReference(type = PasswordPolicyPersistence.class)
660            protected PasswordPolicyPersistence passwordPolicyPersistence;
661            @BeanReference(type = PasswordPolicyRelPersistence.class)
662            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
663            @BeanReference(type = PasswordTrackerPersistence.class)
664            protected PasswordTrackerPersistence passwordTrackerPersistence;
665            @BeanReference(type = PermissionPersistence.class)
666            protected PermissionPersistence permissionPersistence;
667            @BeanReference(type = PhonePersistence.class)
668            protected PhonePersistence phonePersistence;
669            @BeanReference(type = PluginSettingPersistence.class)
670            protected PluginSettingPersistence pluginSettingPersistence;
671            @BeanReference(type = PortalPreferencesPersistence.class)
672            protected PortalPreferencesPersistence portalPreferencesPersistence;
673            @BeanReference(type = PortletPersistence.class)
674            protected PortletPersistence portletPersistence;
675            @BeanReference(type = PortletItemPersistence.class)
676            protected PortletItemPersistence portletItemPersistence;
677            @BeanReference(type = PortletPreferencesPersistence.class)
678            protected PortletPreferencesPersistence portletPreferencesPersistence;
679            @BeanReference(type = RegionPersistence.class)
680            protected RegionPersistence regionPersistence;
681            @BeanReference(type = ReleasePersistence.class)
682            protected ReleasePersistence releasePersistence;
683            @BeanReference(type = RepositoryPersistence.class)
684            protected RepositoryPersistence repositoryPersistence;
685            @BeanReference(type = RepositoryEntryPersistence.class)
686            protected RepositoryEntryPersistence repositoryEntryPersistence;
687            @BeanReference(type = ResourcePersistence.class)
688            protected ResourcePersistence resourcePersistence;
689            @BeanReference(type = ResourceActionPersistence.class)
690            protected ResourceActionPersistence resourceActionPersistence;
691            @BeanReference(type = ResourceBlockPersistence.class)
692            protected ResourceBlockPersistence resourceBlockPersistence;
693            @BeanReference(type = ResourceBlockPermissionPersistence.class)
694            protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
695            @BeanReference(type = ResourceCodePersistence.class)
696            protected ResourceCodePersistence resourceCodePersistence;
697            @BeanReference(type = ResourcePermissionPersistence.class)
698            protected ResourcePermissionPersistence resourcePermissionPersistence;
699            @BeanReference(type = ResourceTypePermissionPersistence.class)
700            protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
701            @BeanReference(type = RolePersistence.class)
702            protected RolePersistence rolePersistence;
703            @BeanReference(type = ServiceComponentPersistence.class)
704            protected ServiceComponentPersistence serviceComponentPersistence;
705            @BeanReference(type = ShardPersistence.class)
706            protected ShardPersistence shardPersistence;
707            @BeanReference(type = SubscriptionPersistence.class)
708            protected SubscriptionPersistence subscriptionPersistence;
709            @BeanReference(type = TeamPersistence.class)
710            protected TeamPersistence teamPersistence;
711            @BeanReference(type = TicketPersistence.class)
712            protected TicketPersistence ticketPersistence;
713            @BeanReference(type = UserPersistence.class)
714            protected UserPersistence userPersistence;
715            @BeanReference(type = UserGroupPersistence.class)
716            protected UserGroupPersistence userGroupPersistence;
717            @BeanReference(type = UserGroupGroupRolePersistence.class)
718            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
719            @BeanReference(type = UserGroupRolePersistence.class)
720            protected UserGroupRolePersistence userGroupRolePersistence;
721            @BeanReference(type = UserIdMapperPersistence.class)
722            protected UserIdMapperPersistence userIdMapperPersistence;
723            @BeanReference(type = UserNotificationEventPersistence.class)
724            protected UserNotificationEventPersistence userNotificationEventPersistence;
725            @BeanReference(type = UserTrackerPersistence.class)
726            protected UserTrackerPersistence userTrackerPersistence;
727            @BeanReference(type = UserTrackerPathPersistence.class)
728            protected UserTrackerPathPersistence userTrackerPathPersistence;
729            @BeanReference(type = VirtualHostPersistence.class)
730            protected VirtualHostPersistence virtualHostPersistence;
731            @BeanReference(type = WebDAVPropsPersistence.class)
732            protected WebDAVPropsPersistence webDAVPropsPersistence;
733            @BeanReference(type = WebsitePersistence.class)
734            protected WebsitePersistence websitePersistence;
735            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
736            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
737            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
738            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
739            private static final String _SQL_SELECT_ACCOUNT = "SELECT account FROM Account account";
740            private static final String _SQL_COUNT_ACCOUNT = "SELECT COUNT(account) FROM Account account";
741            private static final String _ORDER_BY_ENTITY_ALIAS = "account.";
742            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Account exists with the primary key ";
743            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
744            private static Log _log = LogFactoryUtil.getLog(AccountPersistenceImpl.class);
745            private static Account _nullAccount = new AccountImpl() {
746                            @Override
747                            public Object clone() {
748                                    return this;
749                            }
750    
751                            @Override
752                            public CacheModel<Account> toCacheModel() {
753                                    return _nullAccountCacheModel;
754                            }
755                    };
756    
757            private static CacheModel<Account> _nullAccountCacheModel = new CacheModel<Account>() {
758                            public Account toEntityModel() {
759                                    return _nullAccount;
760                            }
761                    };
762    }