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.cache.CacheRegistryUtil;
020    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderPath;
023    import com.liferay.portal.kernel.dao.orm.Query;
024    import com.liferay.portal.kernel.dao.orm.QueryUtil;
025    import com.liferay.portal.kernel.dao.orm.Session;
026    import com.liferay.portal.kernel.exception.SystemException;
027    import com.liferay.portal.kernel.log.Log;
028    import com.liferay.portal.kernel.log.LogFactoryUtil;
029    import com.liferay.portal.kernel.util.GetterUtil;
030    import com.liferay.portal.kernel.util.InstanceFactory;
031    import com.liferay.portal.kernel.util.OrderByComparator;
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    
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 (!session.contains(account)) {
237                                    account = (Account)session.get(AccountImpl.class,
238                                                    account.getPrimaryKeyObj());
239                            }
240    
241                            if (account != null) {
242                                    session.delete(account);
243                            }
244                    }
245                    catch (Exception e) {
246                            throw processException(e);
247                    }
248                    finally {
249                            closeSession(session);
250                    }
251    
252                    if (account != null) {
253                            clearCache(account);
254                    }
255    
256                    return account;
257            }
258    
259            @Override
260            public Account updateImpl(com.liferay.portal.model.Account account)
261                    throws SystemException {
262                    account = toUnwrappedModel(account);
263    
264                    boolean isNew = account.isNew();
265    
266                    Session session = null;
267    
268                    try {
269                            session = openSession();
270    
271                            if (account.isNew()) {
272                                    session.save(account);
273    
274                                    account.setNew(false);
275                            }
276                            else {
277                                    session.merge(account);
278                            }
279                    }
280                    catch (Exception e) {
281                            throw processException(e);
282                    }
283                    finally {
284                            closeSession(session);
285                    }
286    
287                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
288    
289                    if (isNew) {
290                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
291                    }
292    
293                    EntityCacheUtil.putResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
294                            AccountImpl.class, account.getPrimaryKey(), account);
295    
296                    return account;
297            }
298    
299            protected Account toUnwrappedModel(Account account) {
300                    if (account instanceof AccountImpl) {
301                            return account;
302                    }
303    
304                    AccountImpl accountImpl = new AccountImpl();
305    
306                    accountImpl.setNew(account.isNew());
307                    accountImpl.setPrimaryKey(account.getPrimaryKey());
308    
309                    accountImpl.setAccountId(account.getAccountId());
310                    accountImpl.setCompanyId(account.getCompanyId());
311                    accountImpl.setUserId(account.getUserId());
312                    accountImpl.setUserName(account.getUserName());
313                    accountImpl.setCreateDate(account.getCreateDate());
314                    accountImpl.setModifiedDate(account.getModifiedDate());
315                    accountImpl.setParentAccountId(account.getParentAccountId());
316                    accountImpl.setName(account.getName());
317                    accountImpl.setLegalName(account.getLegalName());
318                    accountImpl.setLegalId(account.getLegalId());
319                    accountImpl.setLegalType(account.getLegalType());
320                    accountImpl.setSicCode(account.getSicCode());
321                    accountImpl.setTickerSymbol(account.getTickerSymbol());
322                    accountImpl.setIndustry(account.getIndustry());
323                    accountImpl.setType(account.getType());
324                    accountImpl.setSize(account.getSize());
325    
326                    return accountImpl;
327            }
328    
329            /**
330             * Returns the account with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
331             *
332             * @param primaryKey the primary key of the account
333             * @return the account
334             * @throws com.liferay.portal.NoSuchModelException if a account with the primary key could not be found
335             * @throws SystemException if a system exception occurred
336             */
337            @Override
338            public Account findByPrimaryKey(Serializable primaryKey)
339                    throws NoSuchModelException, SystemException {
340                    return findByPrimaryKey(((Long)primaryKey).longValue());
341            }
342    
343            /**
344             * Returns the account with the primary key or throws a {@link com.liferay.portal.NoSuchAccountException} if it could not be found.
345             *
346             * @param accountId the primary key of the account
347             * @return the account
348             * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found
349             * @throws SystemException if a system exception occurred
350             */
351            public Account findByPrimaryKey(long accountId)
352                    throws NoSuchAccountException, SystemException {
353                    Account account = fetchByPrimaryKey(accountId);
354    
355                    if (account == null) {
356                            if (_log.isWarnEnabled()) {
357                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + accountId);
358                            }
359    
360                            throw new NoSuchAccountException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
361                                    accountId);
362                    }
363    
364                    return account;
365            }
366    
367            /**
368             * Returns the account with the primary key or returns <code>null</code> if it could not be found.
369             *
370             * @param primaryKey the primary key of the account
371             * @return the account, or <code>null</code> if a account with the primary key could not be found
372             * @throws SystemException if a system exception occurred
373             */
374            @Override
375            public Account fetchByPrimaryKey(Serializable primaryKey)
376                    throws SystemException {
377                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
378            }
379    
380            /**
381             * Returns the account with the primary key or returns <code>null</code> if it could not be found.
382             *
383             * @param accountId the primary key of the account
384             * @return the account, or <code>null</code> if a account with the primary key could not be found
385             * @throws SystemException if a system exception occurred
386             */
387            public Account fetchByPrimaryKey(long accountId) throws SystemException {
388                    Account account = (Account)EntityCacheUtil.getResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
389                                    AccountImpl.class, accountId);
390    
391                    if (account == _nullAccount) {
392                            return null;
393                    }
394    
395                    if (account == null) {
396                            Session session = null;
397    
398                            try {
399                                    session = openSession();
400    
401                                    account = (Account)session.get(AccountImpl.class,
402                                                    Long.valueOf(accountId));
403    
404                                    if (account != null) {
405                                            cacheResult(account);
406                                    }
407                                    else {
408                                            EntityCacheUtil.putResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
409                                                    AccountImpl.class, accountId, _nullAccount);
410                                    }
411                            }
412                            catch (Exception e) {
413                                    EntityCacheUtil.removeResult(AccountModelImpl.ENTITY_CACHE_ENABLED,
414                                            AccountImpl.class, accountId);
415    
416                                    throw processException(e);
417                            }
418                            finally {
419                                    closeSession(session);
420                            }
421                    }
422    
423                    return account;
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            /**
594             * Initializes the account persistence.
595             */
596            public void afterPropertiesSet() {
597                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
598                                            com.liferay.portal.util.PropsUtil.get(
599                                                    "value.object.listener.com.liferay.portal.model.Account")));
600    
601                    if (listenerClassNames.length > 0) {
602                            try {
603                                    List<ModelListener<Account>> listenersList = new ArrayList<ModelListener<Account>>();
604    
605                                    for (String listenerClassName : listenerClassNames) {
606                                            listenersList.add((ModelListener<Account>)InstanceFactory.newInstance(
607                                                            listenerClassName));
608                                    }
609    
610                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
611                            }
612                            catch (Exception e) {
613                                    _log.error(e);
614                            }
615                    }
616            }
617    
618            public void destroy() {
619                    EntityCacheUtil.removeCache(AccountImpl.class.getName());
620                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
621                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
622                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
623            }
624    
625            private static final String _SQL_SELECT_ACCOUNT = "SELECT account FROM Account account";
626            private static final String _SQL_COUNT_ACCOUNT = "SELECT COUNT(account) FROM Account account";
627            private static final String _ORDER_BY_ENTITY_ALIAS = "account.";
628            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Account exists with the primary key ";
629            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
630            private static Log _log = LogFactoryUtil.getLog(AccountPersistenceImpl.class);
631            private static Account _nullAccount = new AccountImpl() {
632                            @Override
633                            public Object clone() {
634                                    return this;
635                            }
636    
637                            @Override
638                            public CacheModel<Account> toCacheModel() {
639                                    return _nullAccountCacheModel;
640                            }
641                    };
642    
643            private static CacheModel<Account> _nullAccountCacheModel = new CacheModel<Account>() {
644                            public Account toEntityModel() {
645                                    return _nullAccount;
646                            }
647                    };
648    }