001    /**
002     * Copyright (c) 2000-2012 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                            if (account.isCachedModel()) {
237                                    account = (Account)session.get(AccountImpl.class,
238                                                    account.getPrimaryKeyObj());
239                            }
240    
241                            session.delete(account);
242                    }
243                    catch (Exception e) {
244                            throw processException(e);
245                    }
246                    finally {
247                            closeSession(session);
248                    }
249    
250                    clearCache(account);
251    
252                    return account;
253            }
254    
255            @Override
256            public Account updateImpl(com.liferay.portal.model.Account account)
257                    throws SystemException {
258                    account = toUnwrappedModel(account);
259    
260                    boolean isNew = account.isNew();
261    
262                    Session session = null;
263    
264                    try {
265                            session = openSession();
266    
267                            if (account.isNew()) {
268                                    session.save(account);
269    
270                                    account.setNew(false);
271                            }
272                            else {
273                                    session.merge(account);
274                            }
275                    }
276                    catch (Exception e) {
277                            throw processException(e);
278                    }
279                    finally {
280                            closeSession(session);
281                    }
282    
283                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
284    
285                    if (isNew) {
286                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
287                    }
288    
289                    EntityCacheUtil.putResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
290                            AccountImpl.class, account.getPrimaryKey(), account);
291    
292                    return account;
293            }
294    
295            protected Account toUnwrappedModel(Account account) {
296                    if (account instanceof AccountImpl) {
297                            return account;
298                    }
299    
300                    AccountImpl accountImpl = new AccountImpl();
301    
302                    accountImpl.setNew(account.isNew());
303                    accountImpl.setPrimaryKey(account.getPrimaryKey());
304    
305                    accountImpl.setAccountId(account.getAccountId());
306                    accountImpl.setCompanyId(account.getCompanyId());
307                    accountImpl.setUserId(account.getUserId());
308                    accountImpl.setUserName(account.getUserName());
309                    accountImpl.setCreateDate(account.getCreateDate());
310                    accountImpl.setModifiedDate(account.getModifiedDate());
311                    accountImpl.setParentAccountId(account.getParentAccountId());
312                    accountImpl.setName(account.getName());
313                    accountImpl.setLegalName(account.getLegalName());
314                    accountImpl.setLegalId(account.getLegalId());
315                    accountImpl.setLegalType(account.getLegalType());
316                    accountImpl.setSicCode(account.getSicCode());
317                    accountImpl.setTickerSymbol(account.getTickerSymbol());
318                    accountImpl.setIndustry(account.getIndustry());
319                    accountImpl.setType(account.getType());
320                    accountImpl.setSize(account.getSize());
321    
322                    return accountImpl;
323            }
324    
325            /**
326             * Returns the account with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
327             *
328             * @param primaryKey the primary key of the account
329             * @return the account
330             * @throws com.liferay.portal.NoSuchModelException if a account with the primary key could not be found
331             * @throws SystemException if a system exception occurred
332             */
333            @Override
334            public Account findByPrimaryKey(Serializable primaryKey)
335                    throws NoSuchModelException, SystemException {
336                    return findByPrimaryKey(((Long)primaryKey).longValue());
337            }
338    
339            /**
340             * Returns the account with the primary key or throws a {@link com.liferay.portal.NoSuchAccountException} if it could not be found.
341             *
342             * @param accountId the primary key of the account
343             * @return the account
344             * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found
345             * @throws SystemException if a system exception occurred
346             */
347            public Account findByPrimaryKey(long accountId)
348                    throws NoSuchAccountException, SystemException {
349                    Account account = fetchByPrimaryKey(accountId);
350    
351                    if (account == null) {
352                            if (_log.isWarnEnabled()) {
353                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + accountId);
354                            }
355    
356                            throw new NoSuchAccountException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
357                                    accountId);
358                    }
359    
360                    return account;
361            }
362    
363            /**
364             * Returns the account with the primary key or returns <code>null</code> if it could not be found.
365             *
366             * @param primaryKey the primary key of the account
367             * @return the account, or <code>null</code> if a account with the primary key could not be found
368             * @throws SystemException if a system exception occurred
369             */
370            @Override
371            public Account fetchByPrimaryKey(Serializable primaryKey)
372                    throws SystemException {
373                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
374            }
375    
376            /**
377             * Returns the account with the primary key or returns <code>null</code> if it could not be found.
378             *
379             * @param accountId the primary key of the account
380             * @return the account, or <code>null</code> if a account with the primary key could not be found
381             * @throws SystemException if a system exception occurred
382             */
383            public Account fetchByPrimaryKey(long accountId) throws SystemException {
384                    Account account = (Account)EntityCacheUtil.getResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
385                                    AccountImpl.class, accountId);
386    
387                    if (account == _nullAccount) {
388                            return null;
389                    }
390    
391                    if (account == null) {
392                            Session session = null;
393    
394                            boolean hasException = false;
395    
396                            try {
397                                    session = openSession();
398    
399                                    account = (Account)session.get(AccountImpl.class,
400                                                    Long.valueOf(accountId));
401                            }
402                            catch (Exception e) {
403                                    hasException = true;
404    
405                                    throw processException(e);
406                            }
407                            finally {
408                                    if (account != null) {
409                                            cacheResult(account);
410                                    }
411                                    else if (!hasException) {
412                                            EntityCacheUtil.putResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
413                                                    AccountImpl.class, accountId, _nullAccount);
414                                    }
415    
416                                    closeSession(session);
417                            }
418                    }
419    
420                    return account;
421            }
422    
423            /**
424             * Returns all the accounts.
425             *
426             * @return the accounts
427             * @throws SystemException if a system exception occurred
428             */
429            public List<Account> findAll() throws SystemException {
430                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
431            }
432    
433            /**
434             * Returns a range of all the accounts.
435             *
436             * <p>
437             * 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.
438             * </p>
439             *
440             * @param start the lower bound of the range of accounts
441             * @param end the upper bound of the range of accounts (not inclusive)
442             * @return the range of accounts
443             * @throws SystemException if a system exception occurred
444             */
445            public List<Account> findAll(int start, int end) throws SystemException {
446                    return findAll(start, end, null);
447            }
448    
449            /**
450             * Returns an ordered range of all the accounts.
451             *
452             * <p>
453             * 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.
454             * </p>
455             *
456             * @param start the lower bound of the range of accounts
457             * @param end the upper bound of the range of accounts (not inclusive)
458             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
459             * @return the ordered range of accounts
460             * @throws SystemException if a system exception occurred
461             */
462            public List<Account> findAll(int start, int end,
463                    OrderByComparator orderByComparator) throws SystemException {
464                    FinderPath finderPath = null;
465                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
466    
467                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
468                                    (orderByComparator == null)) {
469                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
470                            finderArgs = FINDER_ARGS_EMPTY;
471                    }
472                    else {
473                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
474                            finderArgs = new Object[] { start, end, orderByComparator };
475                    }
476    
477                    List<Account> list = (List<Account>)FinderCacheUtil.getResult(finderPath,
478                                    finderArgs, this);
479    
480                    if (list == null) {
481                            StringBundler query = null;
482                            String sql = null;
483    
484                            if (orderByComparator != null) {
485                                    query = new StringBundler(2 +
486                                                    (orderByComparator.getOrderByFields().length * 3));
487    
488                                    query.append(_SQL_SELECT_ACCOUNT);
489    
490                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
491                                            orderByComparator);
492    
493                                    sql = query.toString();
494                            }
495                            else {
496                                    sql = _SQL_SELECT_ACCOUNT;
497                            }
498    
499                            Session session = null;
500    
501                            try {
502                                    session = openSession();
503    
504                                    Query q = session.createQuery(sql);
505    
506                                    if (orderByComparator == null) {
507                                            list = (List<Account>)QueryUtil.list(q, getDialect(),
508                                                            start, end, false);
509    
510                                            Collections.sort(list);
511                                    }
512                                    else {
513                                            list = (List<Account>)QueryUtil.list(q, getDialect(),
514                                                            start, end);
515                                    }
516                            }
517                            catch (Exception e) {
518                                    throw processException(e);
519                            }
520                            finally {
521                                    if (list == null) {
522                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
523                                    }
524                                    else {
525                                            cacheResult(list);
526    
527                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
528                                    }
529    
530                                    closeSession(session);
531                            }
532                    }
533    
534                    return list;
535            }
536    
537            /**
538             * Removes all the accounts from the database.
539             *
540             * @throws SystemException if a system exception occurred
541             */
542            public void removeAll() throws SystemException {
543                    for (Account account : findAll()) {
544                            remove(account);
545                    }
546            }
547    
548            /**
549             * Returns the number of accounts.
550             *
551             * @return the number of accounts
552             * @throws SystemException if a system exception occurred
553             */
554            public int countAll() throws SystemException {
555                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
556                                    FINDER_ARGS_EMPTY, this);
557    
558                    if (count == null) {
559                            Session session = null;
560    
561                            try {
562                                    session = openSession();
563    
564                                    Query q = session.createQuery(_SQL_COUNT_ACCOUNT);
565    
566                                    count = (Long)q.uniqueResult();
567                            }
568                            catch (Exception e) {
569                                    throw processException(e);
570                            }
571                            finally {
572                                    if (count == null) {
573                                            count = Long.valueOf(0);
574                                    }
575    
576                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
577                                            FINDER_ARGS_EMPTY, count);
578    
579                                    closeSession(session);
580                            }
581                    }
582    
583                    return count.intValue();
584            }
585    
586            /**
587             * Initializes the account persistence.
588             */
589            public void afterPropertiesSet() {
590                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
591                                            com.liferay.portal.util.PropsUtil.get(
592                                                    "value.object.listener.com.liferay.portal.model.Account")));
593    
594                    if (listenerClassNames.length > 0) {
595                            try {
596                                    List<ModelListener<Account>> listenersList = new ArrayList<ModelListener<Account>>();
597    
598                                    for (String listenerClassName : listenerClassNames) {
599                                            listenersList.add((ModelListener<Account>)InstanceFactory.newInstance(
600                                                            listenerClassName));
601                                    }
602    
603                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
604                            }
605                            catch (Exception e) {
606                                    _log.error(e);
607                            }
608                    }
609            }
610    
611            public void destroy() {
612                    EntityCacheUtil.removeCache(AccountImpl.class.getName());
613                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
614                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
615            }
616    
617            @BeanReference(type = AccountPersistence.class)
618            protected AccountPersistence accountPersistence;
619            @BeanReference(type = AddressPersistence.class)
620            protected AddressPersistence addressPersistence;
621            @BeanReference(type = BrowserTrackerPersistence.class)
622            protected BrowserTrackerPersistence browserTrackerPersistence;
623            @BeanReference(type = ClassNamePersistence.class)
624            protected ClassNamePersistence classNamePersistence;
625            @BeanReference(type = ClusterGroupPersistence.class)
626            protected ClusterGroupPersistence clusterGroupPersistence;
627            @BeanReference(type = CompanyPersistence.class)
628            protected CompanyPersistence companyPersistence;
629            @BeanReference(type = ContactPersistence.class)
630            protected ContactPersistence contactPersistence;
631            @BeanReference(type = CountryPersistence.class)
632            protected CountryPersistence countryPersistence;
633            @BeanReference(type = EmailAddressPersistence.class)
634            protected EmailAddressPersistence emailAddressPersistence;
635            @BeanReference(type = GroupPersistence.class)
636            protected GroupPersistence groupPersistence;
637            @BeanReference(type = ImagePersistence.class)
638            protected ImagePersistence imagePersistence;
639            @BeanReference(type = LayoutPersistence.class)
640            protected LayoutPersistence layoutPersistence;
641            @BeanReference(type = LayoutBranchPersistence.class)
642            protected LayoutBranchPersistence layoutBranchPersistence;
643            @BeanReference(type = LayoutPrototypePersistence.class)
644            protected LayoutPrototypePersistence layoutPrototypePersistence;
645            @BeanReference(type = LayoutRevisionPersistence.class)
646            protected LayoutRevisionPersistence layoutRevisionPersistence;
647            @BeanReference(type = LayoutSetPersistence.class)
648            protected LayoutSetPersistence layoutSetPersistence;
649            @BeanReference(type = LayoutSetBranchPersistence.class)
650            protected LayoutSetBranchPersistence layoutSetBranchPersistence;
651            @BeanReference(type = LayoutSetPrototypePersistence.class)
652            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
653            @BeanReference(type = ListTypePersistence.class)
654            protected ListTypePersistence listTypePersistence;
655            @BeanReference(type = LockPersistence.class)
656            protected LockPersistence lockPersistence;
657            @BeanReference(type = MembershipRequestPersistence.class)
658            protected MembershipRequestPersistence membershipRequestPersistence;
659            @BeanReference(type = OrganizationPersistence.class)
660            protected OrganizationPersistence organizationPersistence;
661            @BeanReference(type = OrgGroupRolePersistence.class)
662            protected OrgGroupRolePersistence orgGroupRolePersistence;
663            @BeanReference(type = OrgLaborPersistence.class)
664            protected OrgLaborPersistence orgLaborPersistence;
665            @BeanReference(type = PasswordPolicyPersistence.class)
666            protected PasswordPolicyPersistence passwordPolicyPersistence;
667            @BeanReference(type = PasswordPolicyRelPersistence.class)
668            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
669            @BeanReference(type = PasswordTrackerPersistence.class)
670            protected PasswordTrackerPersistence passwordTrackerPersistence;
671            @BeanReference(type = PhonePersistence.class)
672            protected PhonePersistence phonePersistence;
673            @BeanReference(type = PluginSettingPersistence.class)
674            protected PluginSettingPersistence pluginSettingPersistence;
675            @BeanReference(type = PortalPreferencesPersistence.class)
676            protected PortalPreferencesPersistence portalPreferencesPersistence;
677            @BeanReference(type = PortletPersistence.class)
678            protected PortletPersistence portletPersistence;
679            @BeanReference(type = PortletItemPersistence.class)
680            protected PortletItemPersistence portletItemPersistence;
681            @BeanReference(type = PortletPreferencesPersistence.class)
682            protected PortletPreferencesPersistence portletPreferencesPersistence;
683            @BeanReference(type = RegionPersistence.class)
684            protected RegionPersistence regionPersistence;
685            @BeanReference(type = ReleasePersistence.class)
686            protected ReleasePersistence releasePersistence;
687            @BeanReference(type = RepositoryPersistence.class)
688            protected RepositoryPersistence repositoryPersistence;
689            @BeanReference(type = RepositoryEntryPersistence.class)
690            protected RepositoryEntryPersistence repositoryEntryPersistence;
691            @BeanReference(type = ResourceActionPersistence.class)
692            protected ResourceActionPersistence resourceActionPersistence;
693            @BeanReference(type = ResourceBlockPersistence.class)
694            protected ResourceBlockPersistence resourceBlockPersistence;
695            @BeanReference(type = ResourceBlockPermissionPersistence.class)
696            protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
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    }