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