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            /**
084             * Caches the account in the entity cache if it is enabled.
085             *
086             * @param account the account
087             */
088            public void cacheResult(Account account) {
089                    EntityCacheUtil.putResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
090                            AccountImpl.class, account.getPrimaryKey(), account);
091    
092                    account.resetOriginalValues();
093            }
094    
095            /**
096             * Caches the accounts in the entity cache if it is enabled.
097             *
098             * @param accounts the accounts
099             */
100            public void cacheResult(List<Account> accounts) {
101                    for (Account account : accounts) {
102                            if (EntityCacheUtil.getResult(
103                                                    AccountModelImpl.ENTITY_CACHE_ENABLED,
104                                                    AccountImpl.class, account.getPrimaryKey()) == null) {
105                                    cacheResult(account);
106                            }
107                            else {
108                                    account.resetOriginalValues();
109                            }
110                    }
111            }
112    
113            /**
114             * Clears the cache for all accounts.
115             *
116             * <p>
117             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
118             * </p>
119             */
120            @Override
121            public void clearCache() {
122                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
123                            CacheRegistryUtil.clear(AccountImpl.class.getName());
124                    }
125    
126                    EntityCacheUtil.clearCache(AccountImpl.class.getName());
127    
128                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
129                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
130                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
131            }
132    
133            /**
134             * Clears the cache for the account.
135             *
136             * <p>
137             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
138             * </p>
139             */
140            @Override
141            public void clearCache(Account account) {
142                    EntityCacheUtil.removeResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
143                            AccountImpl.class, account.getPrimaryKey());
144    
145                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
146                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
147            }
148    
149            @Override
150            public void clearCache(List<Account> accounts) {
151                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
152                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
153    
154                    for (Account account : accounts) {
155                            EntityCacheUtil.removeResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
156                                    AccountImpl.class, account.getPrimaryKey());
157                    }
158            }
159    
160            /**
161             * Creates a new account with the primary key. Does not add the account to the database.
162             *
163             * @param accountId the primary key for the new account
164             * @return the new account
165             */
166            public Account create(long accountId) {
167                    Account account = new AccountImpl();
168    
169                    account.setNew(true);
170                    account.setPrimaryKey(accountId);
171    
172                    return account;
173            }
174    
175            /**
176             * Removes the account with the primary key from the database. Also notifies the appropriate model listeners.
177             *
178             * @param accountId the primary key of the account
179             * @return the account that was removed
180             * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found
181             * @throws SystemException if a system exception occurred
182             */
183            public Account remove(long accountId)
184                    throws NoSuchAccountException, SystemException {
185                    return remove((Serializable)accountId);
186            }
187    
188            /**
189             * Removes the account with the primary key from the database. Also notifies the appropriate model listeners.
190             *
191             * @param primaryKey the primary key of the account
192             * @return the account that was removed
193             * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found
194             * @throws SystemException if a system exception occurred
195             */
196            @Override
197            public Account remove(Serializable primaryKey)
198                    throws NoSuchAccountException, SystemException {
199                    Session session = null;
200    
201                    try {
202                            session = openSession();
203    
204                            Account account = (Account)session.get(AccountImpl.class, primaryKey);
205    
206                            if (account == null) {
207                                    if (_log.isWarnEnabled()) {
208                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
209                                    }
210    
211                                    throw new NoSuchAccountException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
212                                            primaryKey);
213                            }
214    
215                            return remove(account);
216                    }
217                    catch (NoSuchAccountException nsee) {
218                            throw nsee;
219                    }
220                    catch (Exception e) {
221                            throw processException(e);
222                    }
223                    finally {
224                            closeSession(session);
225                    }
226            }
227    
228            @Override
229            protected Account removeImpl(Account account) throws SystemException {
230                    account = toUnwrappedModel(account);
231    
232                    Session session = null;
233    
234                    try {
235                            session = openSession();
236    
237                            if (!session.contains(account)) {
238                                    account = (Account)session.get(AccountImpl.class,
239                                                    account.getPrimaryKeyObj());
240                            }
241    
242                            if (account != null) {
243                                    session.delete(account);
244                            }
245                    }
246                    catch (Exception e) {
247                            throw processException(e);
248                    }
249                    finally {
250                            closeSession(session);
251                    }
252    
253                    if (account != null) {
254                            clearCache(account);
255                    }
256    
257                    return account;
258            }
259    
260            @Override
261            public Account updateImpl(com.liferay.portal.model.Account account)
262                    throws SystemException {
263                    account = toUnwrappedModel(account);
264    
265                    boolean isNew = account.isNew();
266    
267                    Session session = null;
268    
269                    try {
270                            session = openSession();
271    
272                            if (account.isNew()) {
273                                    session.save(account);
274    
275                                    account.setNew(false);
276                            }
277                            else {
278                                    session.merge(account);
279                            }
280                    }
281                    catch (Exception e) {
282                            throw processException(e);
283                    }
284                    finally {
285                            closeSession(session);
286                    }
287    
288                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
289    
290                    if (isNew) {
291                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
292                    }
293    
294                    EntityCacheUtil.putResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
295                            AccountImpl.class, account.getPrimaryKey(), account);
296    
297                    return account;
298            }
299    
300            protected Account toUnwrappedModel(Account account) {
301                    if (account instanceof AccountImpl) {
302                            return account;
303                    }
304    
305                    AccountImpl accountImpl = new AccountImpl();
306    
307                    accountImpl.setNew(account.isNew());
308                    accountImpl.setPrimaryKey(account.getPrimaryKey());
309    
310                    accountImpl.setAccountId(account.getAccountId());
311                    accountImpl.setCompanyId(account.getCompanyId());
312                    accountImpl.setUserId(account.getUserId());
313                    accountImpl.setUserName(account.getUserName());
314                    accountImpl.setCreateDate(account.getCreateDate());
315                    accountImpl.setModifiedDate(account.getModifiedDate());
316                    accountImpl.setParentAccountId(account.getParentAccountId());
317                    accountImpl.setName(account.getName());
318                    accountImpl.setLegalName(account.getLegalName());
319                    accountImpl.setLegalId(account.getLegalId());
320                    accountImpl.setLegalType(account.getLegalType());
321                    accountImpl.setSicCode(account.getSicCode());
322                    accountImpl.setTickerSymbol(account.getTickerSymbol());
323                    accountImpl.setIndustry(account.getIndustry());
324                    accountImpl.setType(account.getType());
325                    accountImpl.setSize(account.getSize());
326    
327                    return accountImpl;
328            }
329    
330            /**
331             * Returns the account with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
332             *
333             * @param primaryKey the primary key of the account
334             * @return the account
335             * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found
336             * @throws SystemException if a system exception occurred
337             */
338            @Override
339            public Account findByPrimaryKey(Serializable primaryKey)
340                    throws NoSuchAccountException, SystemException {
341                    Account account = fetchByPrimaryKey(primaryKey);
342    
343                    if (account == null) {
344                            if (_log.isWarnEnabled()) {
345                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
346                            }
347    
348                            throw new NoSuchAccountException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
349                                    primaryKey);
350                    }
351    
352                    return account;
353            }
354    
355            /**
356             * Returns the account with the primary key or throws a {@link com.liferay.portal.NoSuchAccountException} if it could not be found.
357             *
358             * @param accountId the primary key of the account
359             * @return the account
360             * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found
361             * @throws SystemException if a system exception occurred
362             */
363            public Account findByPrimaryKey(long accountId)
364                    throws NoSuchAccountException, SystemException {
365                    return findByPrimaryKey((Serializable)accountId);
366            }
367    
368            /**
369             * Returns the account with the primary key or returns <code>null</code> if it could not be found.
370             *
371             * @param primaryKey the primary key of the account
372             * @return the account, or <code>null</code> if a account with the primary key could not be found
373             * @throws SystemException if a system exception occurred
374             */
375            @Override
376            public Account fetchByPrimaryKey(Serializable primaryKey)
377                    throws SystemException {
378                    Account account = (Account)EntityCacheUtil.getResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
379                                    AccountImpl.class, primaryKey);
380    
381                    if (account == _nullAccount) {
382                            return null;
383                    }
384    
385                    if (account == null) {
386                            Session session = null;
387    
388                            try {
389                                    session = openSession();
390    
391                                    account = (Account)session.get(AccountImpl.class, primaryKey);
392    
393                                    if (account != null) {
394                                            cacheResult(account);
395                                    }
396                                    else {
397                                            EntityCacheUtil.putResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
398                                                    AccountImpl.class, primaryKey, _nullAccount);
399                                    }
400                            }
401                            catch (Exception e) {
402                                    EntityCacheUtil.removeResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
403                                            AccountImpl.class, primaryKey);
404    
405                                    throw processException(e);
406                            }
407                            finally {
408                                    closeSession(session);
409                            }
410                    }
411    
412                    return account;
413            }
414    
415            /**
416             * Returns the account with the primary key or returns <code>null</code> if it could not be found.
417             *
418             * @param accountId the primary key of the account
419             * @return the account, or <code>null</code> if a account with the primary key could not be found
420             * @throws SystemException if a system exception occurred
421             */
422            public Account fetchByPrimaryKey(long accountId) throws SystemException {
423                    return fetchByPrimaryKey((Serializable)accountId);
424            }
425    
426            /**
427             * Returns all the accounts.
428             *
429             * @return the accounts
430             * @throws SystemException if a system exception occurred
431             */
432            public List<Account> findAll() throws SystemException {
433                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
434            }
435    
436            /**
437             * Returns a range of all the accounts.
438             *
439             * <p>
440             * 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.
441             * </p>
442             *
443             * @param start the lower bound of the range of accounts
444             * @param end the upper bound of the range of accounts (not inclusive)
445             * @return the range of accounts
446             * @throws SystemException if a system exception occurred
447             */
448            public List<Account> findAll(int start, int end) throws SystemException {
449                    return findAll(start, end, null);
450            }
451    
452            /**
453             * Returns an ordered range of all the accounts.
454             *
455             * <p>
456             * 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.
457             * </p>
458             *
459             * @param start the lower bound of the range of accounts
460             * @param end the upper bound of the range of accounts (not inclusive)
461             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
462             * @return the ordered range of accounts
463             * @throws SystemException if a system exception occurred
464             */
465            public List<Account> findAll(int start, int end,
466                    OrderByComparator orderByComparator) throws SystemException {
467                    boolean pagination = true;
468                    FinderPath finderPath = null;
469                    Object[] finderArgs = null;
470    
471                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
472                                    (orderByComparator == null)) {
473                            pagination = false;
474                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
475                            finderArgs = FINDER_ARGS_EMPTY;
476                    }
477                    else {
478                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
479                            finderArgs = new Object[] { start, end, orderByComparator };
480                    }
481    
482                    List<Account> list = (List<Account>)FinderCacheUtil.getResult(finderPath,
483                                    finderArgs, this);
484    
485                    if (list == null) {
486                            StringBundler query = null;
487                            String sql = null;
488    
489                            if (orderByComparator != null) {
490                                    query = new StringBundler(2 +
491                                                    (orderByComparator.getOrderByFields().length * 3));
492    
493                                    query.append(_SQL_SELECT_ACCOUNT);
494    
495                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
496                                            orderByComparator);
497    
498                                    sql = query.toString();
499                            }
500                            else {
501                                    sql = _SQL_SELECT_ACCOUNT;
502    
503                                    if (pagination) {
504                                            sql = sql.concat(AccountModelImpl.ORDER_BY_JPQL);
505                                    }
506                            }
507    
508                            Session session = null;
509    
510                            try {
511                                    session = openSession();
512    
513                                    Query q = session.createQuery(sql);
514    
515                                    if (!pagination) {
516                                            list = (List<Account>)QueryUtil.list(q, getDialect(),
517                                                            start, end, false);
518    
519                                            Collections.sort(list);
520    
521                                            list = new UnmodifiableList<Account>(list);
522                                    }
523                                    else {
524                                            list = (List<Account>)QueryUtil.list(q, getDialect(),
525                                                            start, end);
526                                    }
527    
528                                    cacheResult(list);
529    
530                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
531                            }
532                            catch (Exception e) {
533                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
534    
535                                    throw processException(e);
536                            }
537                            finally {
538                                    closeSession(session);
539                            }
540                    }
541    
542                    return list;
543            }
544    
545            /**
546             * Removes all the accounts from the database.
547             *
548             * @throws SystemException if a system exception occurred
549             */
550            public void removeAll() throws SystemException {
551                    for (Account account : findAll()) {
552                            remove(account);
553                    }
554            }
555    
556            /**
557             * Returns the number of accounts.
558             *
559             * @return the number of accounts
560             * @throws SystemException if a system exception occurred
561             */
562            public int countAll() throws SystemException {
563                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
564                                    FINDER_ARGS_EMPTY, this);
565    
566                    if (count == null) {
567                            Session session = null;
568    
569                            try {
570                                    session = openSession();
571    
572                                    Query q = session.createQuery(_SQL_COUNT_ACCOUNT);
573    
574                                    count = (Long)q.uniqueResult();
575    
576                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
577                                            FINDER_ARGS_EMPTY, count);
578                            }
579                            catch (Exception e) {
580                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
581                                            FINDER_ARGS_EMPTY);
582    
583                                    throw processException(e);
584                            }
585                            finally {
586                                    closeSession(session);
587                            }
588                    }
589    
590                    return count.intValue();
591            }
592    
593            @Override
594            protected Set<String> getBadColumnNames() {
595                    return _badColumnNames;
596            }
597    
598            /**
599             * Initializes the account persistence.
600             */
601            public void afterPropertiesSet() {
602                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
603                                            com.liferay.portal.util.PropsUtil.get(
604                                                    "value.object.listener.com.liferay.portal.model.Account")));
605    
606                    if (listenerClassNames.length > 0) {
607                            try {
608                                    List<ModelListener<Account>> listenersList = new ArrayList<ModelListener<Account>>();
609    
610                                    for (String listenerClassName : listenerClassNames) {
611                                            listenersList.add((ModelListener<Account>)InstanceFactory.newInstance(
612                                                            getClassLoader(), listenerClassName));
613                                    }
614    
615                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
616                            }
617                            catch (Exception e) {
618                                    _log.error(e);
619                            }
620                    }
621            }
622    
623            public void destroy() {
624                    EntityCacheUtil.removeCache(AccountImpl.class.getName());
625                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
626                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
627                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
628            }
629    
630            private static final String _SQL_SELECT_ACCOUNT = "SELECT account FROM Account account";
631            private static final String _SQL_COUNT_ACCOUNT = "SELECT COUNT(account) FROM Account account";
632            private static final String _ORDER_BY_ENTITY_ALIAS = "account.";
633            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Account exists with the primary key ";
634            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
635            private static Log _log = LogFactoryUtil.getLog(AccountPersistenceImpl.class);
636            private static Set<String> _badColumnNames = SetUtil.fromArray(new String[] {
637                                    "type", "size"
638                            });
639            private static Account _nullAccount = new AccountImpl() {
640                            @Override
641                            public Object clone() {
642                                    return this;
643                            }
644    
645                            @Override
646                            public CacheModel<Account> toCacheModel() {
647                                    return _nullAccountCacheModel;
648                            }
649                    };
650    
651            private static CacheModel<Account> _nullAccountCacheModel = new CacheModel<Account>() {
652                            public Account toEntityModel() {
653                                    return _nullAccount;
654                            }
655                    };
656    }