001    /**
002     * Copyright (c) 2000-2010 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.NoSuchCountryException;
018    import com.liferay.portal.NoSuchModelException;
019    import com.liferay.portal.kernel.annotation.BeanReference;
020    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023    import com.liferay.portal.kernel.dao.orm.FinderPath;
024    import com.liferay.portal.kernel.dao.orm.Query;
025    import com.liferay.portal.kernel.dao.orm.QueryPos;
026    import com.liferay.portal.kernel.dao.orm.QueryUtil;
027    import com.liferay.portal.kernel.dao.orm.Session;
028    import com.liferay.portal.kernel.exception.SystemException;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
031    import com.liferay.portal.kernel.util.GetterUtil;
032    import com.liferay.portal.kernel.util.InstanceFactory;
033    import com.liferay.portal.kernel.util.OrderByComparator;
034    import com.liferay.portal.kernel.util.StringBundler;
035    import com.liferay.portal.kernel.util.StringPool;
036    import com.liferay.portal.kernel.util.StringUtil;
037    import com.liferay.portal.kernel.util.Validator;
038    import com.liferay.portal.model.Country;
039    import com.liferay.portal.model.ModelListener;
040    import com.liferay.portal.model.impl.CountryImpl;
041    import com.liferay.portal.model.impl.CountryModelImpl;
042    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
043    
044    import java.io.Serializable;
045    
046    import java.util.ArrayList;
047    import java.util.Collections;
048    import java.util.List;
049    
050    /**
051     * @author    Brian Wing Shun Chan
052     * @see       CountryPersistence
053     * @see       CountryUtil
054     * @generated
055     */
056    public class CountryPersistenceImpl extends BasePersistenceImpl<Country>
057            implements CountryPersistence {
058            public static final String FINDER_CLASS_NAME_ENTITY = CountryImpl.class.getName();
059            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
060                    ".List";
061            public static final FinderPath FINDER_PATH_FETCH_BY_NAME = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
062                            CountryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
063                            "fetchByName", new String[] { String.class.getName() });
064            public static final FinderPath FINDER_PATH_COUNT_BY_NAME = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
065                            CountryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
066                            "countByName", new String[] { String.class.getName() });
067            public static final FinderPath FINDER_PATH_FETCH_BY_A2 = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
068                            CountryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
069                            "fetchByA2", new String[] { String.class.getName() });
070            public static final FinderPath FINDER_PATH_COUNT_BY_A2 = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
071                            CountryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
072                            "countByA2", new String[] { String.class.getName() });
073            public static final FinderPath FINDER_PATH_FETCH_BY_A3 = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
074                            CountryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
075                            "fetchByA3", new String[] { String.class.getName() });
076            public static final FinderPath FINDER_PATH_COUNT_BY_A3 = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
077                            CountryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
078                            "countByA3", new String[] { String.class.getName() });
079            public static final FinderPath FINDER_PATH_FIND_BY_ACTIVE = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
080                            CountryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
081                            "findByActive",
082                            new String[] {
083                                    Boolean.class.getName(),
084                                    
085                            "java.lang.Integer", "java.lang.Integer",
086                                    "com.liferay.portal.kernel.util.OrderByComparator"
087                            });
088            public static final FinderPath FINDER_PATH_COUNT_BY_ACTIVE = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
089                            CountryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
090                            "countByActive", new String[] { Boolean.class.getName() });
091            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
092                            CountryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
093                            "findAll", new String[0]);
094            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(CountryModelImpl.ENTITY_CACHE_ENABLED,
095                            CountryModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
096                            "countAll", new String[0]);
097    
098            public void cacheResult(Country country) {
099                    EntityCacheUtil.putResult(CountryModelImpl.ENTITY_CACHE_ENABLED,
100                            CountryImpl.class, country.getPrimaryKey(), country);
101    
102                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
103                            new Object[] { country.getName() }, country);
104    
105                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
106                            new Object[] { country.getA2() }, country);
107    
108                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
109                            new Object[] { country.getA3() }, country);
110            }
111    
112            public void cacheResult(List<Country> countries) {
113                    for (Country country : countries) {
114                            if (EntityCacheUtil.getResult(
115                                                    CountryModelImpl.ENTITY_CACHE_ENABLED,
116                                                    CountryImpl.class, country.getPrimaryKey(), this) == null) {
117                                    cacheResult(country);
118                            }
119                    }
120            }
121    
122            public void clearCache() {
123                    CacheRegistryUtil.clear(CountryImpl.class.getName());
124                    EntityCacheUtil.clearCache(CountryImpl.class.getName());
125                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
126                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
127            }
128    
129            public void clearCache(Country country) {
130                    EntityCacheUtil.removeResult(CountryModelImpl.ENTITY_CACHE_ENABLED,
131                            CountryImpl.class, country.getPrimaryKey());
132    
133                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_NAME,
134                            new Object[] { country.getName() });
135    
136                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A2,
137                            new Object[] { country.getA2() });
138    
139                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A3,
140                            new Object[] { country.getA3() });
141            }
142    
143            public Country create(long countryId) {
144                    Country country = new CountryImpl();
145    
146                    country.setNew(true);
147                    country.setPrimaryKey(countryId);
148    
149                    return country;
150            }
151    
152            public Country remove(Serializable primaryKey)
153                    throws NoSuchModelException, SystemException {
154                    return remove(((Long)primaryKey).longValue());
155            }
156    
157            public Country remove(long countryId)
158                    throws NoSuchCountryException, SystemException {
159                    Session session = null;
160    
161                    try {
162                            session = openSession();
163    
164                            Country country = (Country)session.get(CountryImpl.class,
165                                            new Long(countryId));
166    
167                            if (country == null) {
168                                    if (_log.isWarnEnabled()) {
169                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + countryId);
170                                    }
171    
172                                    throw new NoSuchCountryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
173                                            countryId);
174                            }
175    
176                            return remove(country);
177                    }
178                    catch (NoSuchCountryException nsee) {
179                            throw nsee;
180                    }
181                    catch (Exception e) {
182                            throw processException(e);
183                    }
184                    finally {
185                            closeSession(session);
186                    }
187            }
188    
189            protected Country removeImpl(Country country) throws SystemException {
190                    country = toUnwrappedModel(country);
191    
192                    Session session = null;
193    
194                    try {
195                            session = openSession();
196    
197                            if (country.isCachedModel() || BatchSessionUtil.isEnabled()) {
198                                    Object staleObject = session.get(CountryImpl.class,
199                                                    country.getPrimaryKeyObj());
200    
201                                    if (staleObject != null) {
202                                            session.evict(staleObject);
203                                    }
204                            }
205    
206                            session.delete(country);
207    
208                            session.flush();
209                    }
210                    catch (Exception e) {
211                            throw processException(e);
212                    }
213                    finally {
214                            closeSession(session);
215                    }
216    
217                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
218    
219                    CountryModelImpl countryModelImpl = (CountryModelImpl)country;
220    
221                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_NAME,
222                            new Object[] { countryModelImpl.getOriginalName() });
223    
224                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A2,
225                            new Object[] { countryModelImpl.getOriginalA2() });
226    
227                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A3,
228                            new Object[] { countryModelImpl.getOriginalA3() });
229    
230                    EntityCacheUtil.removeResult(CountryModelImpl.ENTITY_CACHE_ENABLED,
231                            CountryImpl.class, country.getPrimaryKey());
232    
233                    return country;
234            }
235    
236            public Country updateImpl(com.liferay.portal.model.Country country,
237                    boolean merge) throws SystemException {
238                    country = toUnwrappedModel(country);
239    
240                    boolean isNew = country.isNew();
241    
242                    CountryModelImpl countryModelImpl = (CountryModelImpl)country;
243    
244                    Session session = null;
245    
246                    try {
247                            session = openSession();
248    
249                            BatchSessionUtil.update(session, country, merge);
250    
251                            country.setNew(false);
252                    }
253                    catch (Exception e) {
254                            throw processException(e);
255                    }
256                    finally {
257                            closeSession(session);
258                    }
259    
260                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
261    
262                    EntityCacheUtil.putResult(CountryModelImpl.ENTITY_CACHE_ENABLED,
263                            CountryImpl.class, country.getPrimaryKey(), country);
264    
265                    if (!isNew &&
266                                    (!Validator.equals(country.getName(),
267                                            countryModelImpl.getOriginalName()))) {
268                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_NAME,
269                                    new Object[] { countryModelImpl.getOriginalName() });
270                    }
271    
272                    if (isNew ||
273                                    (!Validator.equals(country.getName(),
274                                            countryModelImpl.getOriginalName()))) {
275                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
276                                    new Object[] { country.getName() }, country);
277                    }
278    
279                    if (!isNew &&
280                                    (!Validator.equals(country.getA2(),
281                                            countryModelImpl.getOriginalA2()))) {
282                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A2,
283                                    new Object[] { countryModelImpl.getOriginalA2() });
284                    }
285    
286                    if (isNew ||
287                                    (!Validator.equals(country.getA2(),
288                                            countryModelImpl.getOriginalA2()))) {
289                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
290                                    new Object[] { country.getA2() }, country);
291                    }
292    
293                    if (!isNew &&
294                                    (!Validator.equals(country.getA3(),
295                                            countryModelImpl.getOriginalA3()))) {
296                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_A3,
297                                    new Object[] { countryModelImpl.getOriginalA3() });
298                    }
299    
300                    if (isNew ||
301                                    (!Validator.equals(country.getA3(),
302                                            countryModelImpl.getOriginalA3()))) {
303                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
304                                    new Object[] { country.getA3() }, country);
305                    }
306    
307                    return country;
308            }
309    
310            protected Country toUnwrappedModel(Country country) {
311                    if (country instanceof CountryImpl) {
312                            return country;
313                    }
314    
315                    CountryImpl countryImpl = new CountryImpl();
316    
317                    countryImpl.setNew(country.isNew());
318                    countryImpl.setPrimaryKey(country.getPrimaryKey());
319    
320                    countryImpl.setCountryId(country.getCountryId());
321                    countryImpl.setName(country.getName());
322                    countryImpl.setA2(country.getA2());
323                    countryImpl.setA3(country.getA3());
324                    countryImpl.setNumber(country.getNumber());
325                    countryImpl.setIdd(country.getIdd());
326                    countryImpl.setActive(country.isActive());
327    
328                    return countryImpl;
329            }
330    
331            public Country findByPrimaryKey(Serializable primaryKey)
332                    throws NoSuchModelException, SystemException {
333                    return findByPrimaryKey(((Long)primaryKey).longValue());
334            }
335    
336            public Country findByPrimaryKey(long countryId)
337                    throws NoSuchCountryException, SystemException {
338                    Country country = fetchByPrimaryKey(countryId);
339    
340                    if (country == null) {
341                            if (_log.isWarnEnabled()) {
342                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + countryId);
343                            }
344    
345                            throw new NoSuchCountryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
346                                    countryId);
347                    }
348    
349                    return country;
350            }
351    
352            public Country fetchByPrimaryKey(Serializable primaryKey)
353                    throws SystemException {
354                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
355            }
356    
357            public Country fetchByPrimaryKey(long countryId) throws SystemException {
358                    Country country = (Country)EntityCacheUtil.getResult(CountryModelImpl.ENTITY_CACHE_ENABLED,
359                                    CountryImpl.class, countryId, this);
360    
361                    if (country == null) {
362                            Session session = null;
363    
364                            try {
365                                    session = openSession();
366    
367                                    country = (Country)session.get(CountryImpl.class,
368                                                    new Long(countryId));
369                            }
370                            catch (Exception e) {
371                                    throw processException(e);
372                            }
373                            finally {
374                                    if (country != null) {
375                                            cacheResult(country);
376                                    }
377    
378                                    closeSession(session);
379                            }
380                    }
381    
382                    return country;
383            }
384    
385            public Country findByName(String name)
386                    throws NoSuchCountryException, SystemException {
387                    Country country = fetchByName(name);
388    
389                    if (country == null) {
390                            StringBundler msg = new StringBundler(4);
391    
392                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
393    
394                            msg.append("name=");
395                            msg.append(name);
396    
397                            msg.append(StringPool.CLOSE_CURLY_BRACE);
398    
399                            if (_log.isWarnEnabled()) {
400                                    _log.warn(msg.toString());
401                            }
402    
403                            throw new NoSuchCountryException(msg.toString());
404                    }
405    
406                    return country;
407            }
408    
409            public Country fetchByName(String name) throws SystemException {
410                    return fetchByName(name, true);
411            }
412    
413            public Country fetchByName(String name, boolean retrieveFromCache)
414                    throws SystemException {
415                    Object[] finderArgs = new Object[] { name };
416    
417                    Object result = null;
418    
419                    if (retrieveFromCache) {
420                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_NAME,
421                                            finderArgs, this);
422                    }
423    
424                    if (result == null) {
425                            Session session = null;
426    
427                            try {
428                                    session = openSession();
429    
430                                    StringBundler query = new StringBundler(3);
431    
432                                    query.append(_SQL_SELECT_COUNTRY_WHERE);
433    
434                                    if (name == null) {
435                                            query.append(_FINDER_COLUMN_NAME_NAME_1);
436                                    }
437                                    else {
438                                            if (name.equals(StringPool.BLANK)) {
439                                                    query.append(_FINDER_COLUMN_NAME_NAME_3);
440                                            }
441                                            else {
442                                                    query.append(_FINDER_COLUMN_NAME_NAME_2);
443                                            }
444                                    }
445    
446                                    query.append(CountryModelImpl.ORDER_BY_JPQL);
447    
448                                    String sql = query.toString();
449    
450                                    Query q = session.createQuery(sql);
451    
452                                    QueryPos qPos = QueryPos.getInstance(q);
453    
454                                    if (name != null) {
455                                            qPos.add(name);
456                                    }
457    
458                                    List<Country> list = q.list();
459    
460                                    result = list;
461    
462                                    Country country = null;
463    
464                                    if (list.isEmpty()) {
465                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
466                                                    finderArgs, list);
467                                    }
468                                    else {
469                                            country = list.get(0);
470    
471                                            cacheResult(country);
472    
473                                            if ((country.getName() == null) ||
474                                                            !country.getName().equals(name)) {
475                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
476                                                            finderArgs, country);
477                                            }
478                                    }
479    
480                                    return country;
481                            }
482                            catch (Exception e) {
483                                    throw processException(e);
484                            }
485                            finally {
486                                    if (result == null) {
487                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_NAME,
488                                                    finderArgs, new ArrayList<Country>());
489                                    }
490    
491                                    closeSession(session);
492                            }
493                    }
494                    else {
495                            if (result instanceof List<?>) {
496                                    return null;
497                            }
498                            else {
499                                    return (Country)result;
500                            }
501                    }
502            }
503    
504            public Country findByA2(String a2)
505                    throws NoSuchCountryException, SystemException {
506                    Country country = fetchByA2(a2);
507    
508                    if (country == null) {
509                            StringBundler msg = new StringBundler(4);
510    
511                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
512    
513                            msg.append("a2=");
514                            msg.append(a2);
515    
516                            msg.append(StringPool.CLOSE_CURLY_BRACE);
517    
518                            if (_log.isWarnEnabled()) {
519                                    _log.warn(msg.toString());
520                            }
521    
522                            throw new NoSuchCountryException(msg.toString());
523                    }
524    
525                    return country;
526            }
527    
528            public Country fetchByA2(String a2) throws SystemException {
529                    return fetchByA2(a2, true);
530            }
531    
532            public Country fetchByA2(String a2, boolean retrieveFromCache)
533                    throws SystemException {
534                    Object[] finderArgs = new Object[] { a2 };
535    
536                    Object result = null;
537    
538                    if (retrieveFromCache) {
539                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_A2,
540                                            finderArgs, this);
541                    }
542    
543                    if (result == null) {
544                            Session session = null;
545    
546                            try {
547                                    session = openSession();
548    
549                                    StringBundler query = new StringBundler(3);
550    
551                                    query.append(_SQL_SELECT_COUNTRY_WHERE);
552    
553                                    if (a2 == null) {
554                                            query.append(_FINDER_COLUMN_A2_A2_1);
555                                    }
556                                    else {
557                                            if (a2.equals(StringPool.BLANK)) {
558                                                    query.append(_FINDER_COLUMN_A2_A2_3);
559                                            }
560                                            else {
561                                                    query.append(_FINDER_COLUMN_A2_A2_2);
562                                            }
563                                    }
564    
565                                    query.append(CountryModelImpl.ORDER_BY_JPQL);
566    
567                                    String sql = query.toString();
568    
569                                    Query q = session.createQuery(sql);
570    
571                                    QueryPos qPos = QueryPos.getInstance(q);
572    
573                                    if (a2 != null) {
574                                            qPos.add(a2);
575                                    }
576    
577                                    List<Country> list = q.list();
578    
579                                    result = list;
580    
581                                    Country country = null;
582    
583                                    if (list.isEmpty()) {
584                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
585                                                    finderArgs, list);
586                                    }
587                                    else {
588                                            country = list.get(0);
589    
590                                            cacheResult(country);
591    
592                                            if ((country.getA2() == null) ||
593                                                            !country.getA2().equals(a2)) {
594                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
595                                                            finderArgs, country);
596                                            }
597                                    }
598    
599                                    return country;
600                            }
601                            catch (Exception e) {
602                                    throw processException(e);
603                            }
604                            finally {
605                                    if (result == null) {
606                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A2,
607                                                    finderArgs, new ArrayList<Country>());
608                                    }
609    
610                                    closeSession(session);
611                            }
612                    }
613                    else {
614                            if (result instanceof List<?>) {
615                                    return null;
616                            }
617                            else {
618                                    return (Country)result;
619                            }
620                    }
621            }
622    
623            public Country findByA3(String a3)
624                    throws NoSuchCountryException, SystemException {
625                    Country country = fetchByA3(a3);
626    
627                    if (country == null) {
628                            StringBundler msg = new StringBundler(4);
629    
630                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
631    
632                            msg.append("a3=");
633                            msg.append(a3);
634    
635                            msg.append(StringPool.CLOSE_CURLY_BRACE);
636    
637                            if (_log.isWarnEnabled()) {
638                                    _log.warn(msg.toString());
639                            }
640    
641                            throw new NoSuchCountryException(msg.toString());
642                    }
643    
644                    return country;
645            }
646    
647            public Country fetchByA3(String a3) throws SystemException {
648                    return fetchByA3(a3, true);
649            }
650    
651            public Country fetchByA3(String a3, boolean retrieveFromCache)
652                    throws SystemException {
653                    Object[] finderArgs = new Object[] { a3 };
654    
655                    Object result = null;
656    
657                    if (retrieveFromCache) {
658                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_A3,
659                                            finderArgs, this);
660                    }
661    
662                    if (result == null) {
663                            Session session = null;
664    
665                            try {
666                                    session = openSession();
667    
668                                    StringBundler query = new StringBundler(3);
669    
670                                    query.append(_SQL_SELECT_COUNTRY_WHERE);
671    
672                                    if (a3 == null) {
673                                            query.append(_FINDER_COLUMN_A3_A3_1);
674                                    }
675                                    else {
676                                            if (a3.equals(StringPool.BLANK)) {
677                                                    query.append(_FINDER_COLUMN_A3_A3_3);
678                                            }
679                                            else {
680                                                    query.append(_FINDER_COLUMN_A3_A3_2);
681                                            }
682                                    }
683    
684                                    query.append(CountryModelImpl.ORDER_BY_JPQL);
685    
686                                    String sql = query.toString();
687    
688                                    Query q = session.createQuery(sql);
689    
690                                    QueryPos qPos = QueryPos.getInstance(q);
691    
692                                    if (a3 != null) {
693                                            qPos.add(a3);
694                                    }
695    
696                                    List<Country> list = q.list();
697    
698                                    result = list;
699    
700                                    Country country = null;
701    
702                                    if (list.isEmpty()) {
703                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
704                                                    finderArgs, list);
705                                    }
706                                    else {
707                                            country = list.get(0);
708    
709                                            cacheResult(country);
710    
711                                            if ((country.getA3() == null) ||
712                                                            !country.getA3().equals(a3)) {
713                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
714                                                            finderArgs, country);
715                                            }
716                                    }
717    
718                                    return country;
719                            }
720                            catch (Exception e) {
721                                    throw processException(e);
722                            }
723                            finally {
724                                    if (result == null) {
725                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_A3,
726                                                    finderArgs, new ArrayList<Country>());
727                                    }
728    
729                                    closeSession(session);
730                            }
731                    }
732                    else {
733                            if (result instanceof List<?>) {
734                                    return null;
735                            }
736                            else {
737                                    return (Country)result;
738                            }
739                    }
740            }
741    
742            public List<Country> findByActive(boolean active) throws SystemException {
743                    return findByActive(active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
744            }
745    
746            public List<Country> findByActive(boolean active, int start, int end)
747                    throws SystemException {
748                    return findByActive(active, start, end, null);
749            }
750    
751            public List<Country> findByActive(boolean active, int start, int end,
752                    OrderByComparator orderByComparator) throws SystemException {
753                    Object[] finderArgs = new Object[] {
754                                    active,
755                                    
756                                    String.valueOf(start), String.valueOf(end),
757                                    String.valueOf(orderByComparator)
758                            };
759    
760                    List<Country> list = (List<Country>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_ACTIVE,
761                                    finderArgs, this);
762    
763                    if (list == null) {
764                            Session session = null;
765    
766                            try {
767                                    session = openSession();
768    
769                                    StringBundler query = null;
770    
771                                    if (orderByComparator != null) {
772                                            query = new StringBundler(3 +
773                                                            (orderByComparator.getOrderByFields().length * 3));
774                                    }
775                                    else {
776                                            query = new StringBundler(3);
777                                    }
778    
779                                    query.append(_SQL_SELECT_COUNTRY_WHERE);
780    
781                                    query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2);
782    
783                                    if (orderByComparator != null) {
784                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
785                                                    orderByComparator);
786                                    }
787    
788                                    else {
789                                            query.append(CountryModelImpl.ORDER_BY_JPQL);
790                                    }
791    
792                                    String sql = query.toString();
793    
794                                    Query q = session.createQuery(sql);
795    
796                                    QueryPos qPos = QueryPos.getInstance(q);
797    
798                                    qPos.add(active);
799    
800                                    list = (List<Country>)QueryUtil.list(q, getDialect(), start, end);
801                            }
802                            catch (Exception e) {
803                                    throw processException(e);
804                            }
805                            finally {
806                                    if (list == null) {
807                                            list = new ArrayList<Country>();
808                                    }
809    
810                                    cacheResult(list);
811    
812                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_ACTIVE,
813                                            finderArgs, list);
814    
815                                    closeSession(session);
816                            }
817                    }
818    
819                    return list;
820            }
821    
822            public Country findByActive_First(boolean active,
823                    OrderByComparator orderByComparator)
824                    throws NoSuchCountryException, SystemException {
825                    List<Country> list = findByActive(active, 0, 1, orderByComparator);
826    
827                    if (list.isEmpty()) {
828                            StringBundler msg = new StringBundler(4);
829    
830                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
831    
832                            msg.append("active=");
833                            msg.append(active);
834    
835                            msg.append(StringPool.CLOSE_CURLY_BRACE);
836    
837                            throw new NoSuchCountryException(msg.toString());
838                    }
839                    else {
840                            return list.get(0);
841                    }
842            }
843    
844            public Country findByActive_Last(boolean active,
845                    OrderByComparator orderByComparator)
846                    throws NoSuchCountryException, SystemException {
847                    int count = countByActive(active);
848    
849                    List<Country> list = findByActive(active, count - 1, count,
850                                    orderByComparator);
851    
852                    if (list.isEmpty()) {
853                            StringBundler msg = new StringBundler(4);
854    
855                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
856    
857                            msg.append("active=");
858                            msg.append(active);
859    
860                            msg.append(StringPool.CLOSE_CURLY_BRACE);
861    
862                            throw new NoSuchCountryException(msg.toString());
863                    }
864                    else {
865                            return list.get(0);
866                    }
867            }
868    
869            public Country[] findByActive_PrevAndNext(long countryId, boolean active,
870                    OrderByComparator orderByComparator)
871                    throws NoSuchCountryException, SystemException {
872                    Country country = findByPrimaryKey(countryId);
873    
874                    Session session = null;
875    
876                    try {
877                            session = openSession();
878    
879                            Country[] array = new CountryImpl[3];
880    
881                            array[0] = getByActive_PrevAndNext(session, country, active,
882                                            orderByComparator, true);
883    
884                            array[1] = country;
885    
886                            array[2] = getByActive_PrevAndNext(session, country, active,
887                                            orderByComparator, false);
888    
889                            return array;
890                    }
891                    catch (Exception e) {
892                            throw processException(e);
893                    }
894                    finally {
895                            closeSession(session);
896                    }
897            }
898    
899            protected Country getByActive_PrevAndNext(Session session, Country country,
900                    boolean active, OrderByComparator orderByComparator, boolean previous) {
901                    StringBundler query = null;
902    
903                    if (orderByComparator != null) {
904                            query = new StringBundler(6 +
905                                            (orderByComparator.getOrderByFields().length * 6));
906                    }
907                    else {
908                            query = new StringBundler(3);
909                    }
910    
911                    query.append(_SQL_SELECT_COUNTRY_WHERE);
912    
913                    query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2);
914    
915                    if (orderByComparator != null) {
916                            String[] orderByFields = orderByComparator.getOrderByFields();
917    
918                            if (orderByFields.length > 0) {
919                                    query.append(WHERE_AND);
920                            }
921    
922                            for (int i = 0; i < orderByFields.length; i++) {
923                                    query.append(_ORDER_BY_ENTITY_ALIAS);
924                                    query.append(orderByFields[i]);
925    
926                                    if ((i + 1) < orderByFields.length) {
927                                            if (orderByComparator.isAscending() ^ previous) {
928                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
929                                            }
930                                            else {
931                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
932                                            }
933                                    }
934                                    else {
935                                            if (orderByComparator.isAscending() ^ previous) {
936                                                    query.append(WHERE_GREATER_THAN);
937                                            }
938                                            else {
939                                                    query.append(WHERE_LESSER_THAN);
940                                            }
941                                    }
942                            }
943    
944                            query.append(ORDER_BY_CLAUSE);
945    
946                            for (int i = 0; i < orderByFields.length; i++) {
947                                    query.append(_ORDER_BY_ENTITY_ALIAS);
948                                    query.append(orderByFields[i]);
949    
950                                    if ((i + 1) < orderByFields.length) {
951                                            if (orderByComparator.isAscending() ^ previous) {
952                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
953                                            }
954                                            else {
955                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
956                                            }
957                                    }
958                                    else {
959                                            if (orderByComparator.isAscending() ^ previous) {
960                                                    query.append(ORDER_BY_ASC);
961                                            }
962                                            else {
963                                                    query.append(ORDER_BY_DESC);
964                                            }
965                                    }
966                            }
967                    }
968    
969                    else {
970                            query.append(CountryModelImpl.ORDER_BY_JPQL);
971                    }
972    
973                    String sql = query.toString();
974    
975                    Query q = session.createQuery(sql);
976    
977                    q.setFirstResult(0);
978                    q.setMaxResults(2);
979    
980                    QueryPos qPos = QueryPos.getInstance(q);
981    
982                    qPos.add(active);
983    
984                    if (orderByComparator != null) {
985                            Object[] values = orderByComparator.getOrderByValues(country);
986    
987                            for (Object value : values) {
988                                    qPos.add(value);
989                            }
990                    }
991    
992                    List<Country> list = q.list();
993    
994                    if (list.size() == 2) {
995                            return list.get(1);
996                    }
997                    else {
998                            return null;
999                    }
1000            }
1001    
1002            public List<Country> findAll() throws SystemException {
1003                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1004            }
1005    
1006            public List<Country> findAll(int start, int end) throws SystemException {
1007                    return findAll(start, end, null);
1008            }
1009    
1010            public List<Country> findAll(int start, int end,
1011                    OrderByComparator orderByComparator) throws SystemException {
1012                    Object[] finderArgs = new Object[] {
1013                                    String.valueOf(start), String.valueOf(end),
1014                                    String.valueOf(orderByComparator)
1015                            };
1016    
1017                    List<Country> list = (List<Country>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1018                                    finderArgs, this);
1019    
1020                    if (list == null) {
1021                            Session session = null;
1022    
1023                            try {
1024                                    session = openSession();
1025    
1026                                    StringBundler query = null;
1027                                    String sql = null;
1028    
1029                                    if (orderByComparator != null) {
1030                                            query = new StringBundler(2 +
1031                                                            (orderByComparator.getOrderByFields().length * 3));
1032    
1033                                            query.append(_SQL_SELECT_COUNTRY);
1034    
1035                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1036                                                    orderByComparator);
1037    
1038                                            sql = query.toString();
1039                                    }
1040                                    else {
1041                                            sql = _SQL_SELECT_COUNTRY.concat(CountryModelImpl.ORDER_BY_JPQL);
1042                                    }
1043    
1044                                    Query q = session.createQuery(sql);
1045    
1046                                    if (orderByComparator == null) {
1047                                            list = (List<Country>)QueryUtil.list(q, getDialect(),
1048                                                            start, end, false);
1049    
1050                                            Collections.sort(list);
1051                                    }
1052                                    else {
1053                                            list = (List<Country>)QueryUtil.list(q, getDialect(),
1054                                                            start, end);
1055                                    }
1056                            }
1057                            catch (Exception e) {
1058                                    throw processException(e);
1059                            }
1060                            finally {
1061                                    if (list == null) {
1062                                            list = new ArrayList<Country>();
1063                                    }
1064    
1065                                    cacheResult(list);
1066    
1067                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1068    
1069                                    closeSession(session);
1070                            }
1071                    }
1072    
1073                    return list;
1074            }
1075    
1076            public void removeByName(String name)
1077                    throws NoSuchCountryException, SystemException {
1078                    Country country = findByName(name);
1079    
1080                    remove(country);
1081            }
1082    
1083            public void removeByA2(String a2)
1084                    throws NoSuchCountryException, SystemException {
1085                    Country country = findByA2(a2);
1086    
1087                    remove(country);
1088            }
1089    
1090            public void removeByA3(String a3)
1091                    throws NoSuchCountryException, SystemException {
1092                    Country country = findByA3(a3);
1093    
1094                    remove(country);
1095            }
1096    
1097            public void removeByActive(boolean active) throws SystemException {
1098                    for (Country country : findByActive(active)) {
1099                            remove(country);
1100                    }
1101            }
1102    
1103            public void removeAll() throws SystemException {
1104                    for (Country country : findAll()) {
1105                            remove(country);
1106                    }
1107            }
1108    
1109            public int countByName(String name) throws SystemException {
1110                    Object[] finderArgs = new Object[] { name };
1111    
1112                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_NAME,
1113                                    finderArgs, this);
1114    
1115                    if (count == null) {
1116                            Session session = null;
1117    
1118                            try {
1119                                    session = openSession();
1120    
1121                                    StringBundler query = new StringBundler(2);
1122    
1123                                    query.append(_SQL_COUNT_COUNTRY_WHERE);
1124    
1125                                    if (name == null) {
1126                                            query.append(_FINDER_COLUMN_NAME_NAME_1);
1127                                    }
1128                                    else {
1129                                            if (name.equals(StringPool.BLANK)) {
1130                                                    query.append(_FINDER_COLUMN_NAME_NAME_3);
1131                                            }
1132                                            else {
1133                                                    query.append(_FINDER_COLUMN_NAME_NAME_2);
1134                                            }
1135                                    }
1136    
1137                                    String sql = query.toString();
1138    
1139                                    Query q = session.createQuery(sql);
1140    
1141                                    QueryPos qPos = QueryPos.getInstance(q);
1142    
1143                                    if (name != null) {
1144                                            qPos.add(name);
1145                                    }
1146    
1147                                    count = (Long)q.uniqueResult();
1148                            }
1149                            catch (Exception e) {
1150                                    throw processException(e);
1151                            }
1152                            finally {
1153                                    if (count == null) {
1154                                            count = Long.valueOf(0);
1155                                    }
1156    
1157                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_NAME,
1158                                            finderArgs, count);
1159    
1160                                    closeSession(session);
1161                            }
1162                    }
1163    
1164                    return count.intValue();
1165            }
1166    
1167            public int countByA2(String a2) throws SystemException {
1168                    Object[] finderArgs = new Object[] { a2 };
1169    
1170                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_A2,
1171                                    finderArgs, this);
1172    
1173                    if (count == null) {
1174                            Session session = null;
1175    
1176                            try {
1177                                    session = openSession();
1178    
1179                                    StringBundler query = new StringBundler(2);
1180    
1181                                    query.append(_SQL_COUNT_COUNTRY_WHERE);
1182    
1183                                    if (a2 == null) {
1184                                            query.append(_FINDER_COLUMN_A2_A2_1);
1185                                    }
1186                                    else {
1187                                            if (a2.equals(StringPool.BLANK)) {
1188                                                    query.append(_FINDER_COLUMN_A2_A2_3);
1189                                            }
1190                                            else {
1191                                                    query.append(_FINDER_COLUMN_A2_A2_2);
1192                                            }
1193                                    }
1194    
1195                                    String sql = query.toString();
1196    
1197                                    Query q = session.createQuery(sql);
1198    
1199                                    QueryPos qPos = QueryPos.getInstance(q);
1200    
1201                                    if (a2 != null) {
1202                                            qPos.add(a2);
1203                                    }
1204    
1205                                    count = (Long)q.uniqueResult();
1206                            }
1207                            catch (Exception e) {
1208                                    throw processException(e);
1209                            }
1210                            finally {
1211                                    if (count == null) {
1212                                            count = Long.valueOf(0);
1213                                    }
1214    
1215                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_A2, finderArgs,
1216                                            count);
1217    
1218                                    closeSession(session);
1219                            }
1220                    }
1221    
1222                    return count.intValue();
1223            }
1224    
1225            public int countByA3(String a3) throws SystemException {
1226                    Object[] finderArgs = new Object[] { a3 };
1227    
1228                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_A3,
1229                                    finderArgs, this);
1230    
1231                    if (count == null) {
1232                            Session session = null;
1233    
1234                            try {
1235                                    session = openSession();
1236    
1237                                    StringBundler query = new StringBundler(2);
1238    
1239                                    query.append(_SQL_COUNT_COUNTRY_WHERE);
1240    
1241                                    if (a3 == null) {
1242                                            query.append(_FINDER_COLUMN_A3_A3_1);
1243                                    }
1244                                    else {
1245                                            if (a3.equals(StringPool.BLANK)) {
1246                                                    query.append(_FINDER_COLUMN_A3_A3_3);
1247                                            }
1248                                            else {
1249                                                    query.append(_FINDER_COLUMN_A3_A3_2);
1250                                            }
1251                                    }
1252    
1253                                    String sql = query.toString();
1254    
1255                                    Query q = session.createQuery(sql);
1256    
1257                                    QueryPos qPos = QueryPos.getInstance(q);
1258    
1259                                    if (a3 != null) {
1260                                            qPos.add(a3);
1261                                    }
1262    
1263                                    count = (Long)q.uniqueResult();
1264                            }
1265                            catch (Exception e) {
1266                                    throw processException(e);
1267                            }
1268                            finally {
1269                                    if (count == null) {
1270                                            count = Long.valueOf(0);
1271                                    }
1272    
1273                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_A3, finderArgs,
1274                                            count);
1275    
1276                                    closeSession(session);
1277                            }
1278                    }
1279    
1280                    return count.intValue();
1281            }
1282    
1283            public int countByActive(boolean active) throws SystemException {
1284                    Object[] finderArgs = new Object[] { active };
1285    
1286                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ACTIVE,
1287                                    finderArgs, this);
1288    
1289                    if (count == null) {
1290                            Session session = null;
1291    
1292                            try {
1293                                    session = openSession();
1294    
1295                                    StringBundler query = new StringBundler(2);
1296    
1297                                    query.append(_SQL_COUNT_COUNTRY_WHERE);
1298    
1299                                    query.append(_FINDER_COLUMN_ACTIVE_ACTIVE_2);
1300    
1301                                    String sql = query.toString();
1302    
1303                                    Query q = session.createQuery(sql);
1304    
1305                                    QueryPos qPos = QueryPos.getInstance(q);
1306    
1307                                    qPos.add(active);
1308    
1309                                    count = (Long)q.uniqueResult();
1310                            }
1311                            catch (Exception e) {
1312                                    throw processException(e);
1313                            }
1314                            finally {
1315                                    if (count == null) {
1316                                            count = Long.valueOf(0);
1317                                    }
1318    
1319                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ACTIVE,
1320                                            finderArgs, count);
1321    
1322                                    closeSession(session);
1323                            }
1324                    }
1325    
1326                    return count.intValue();
1327            }
1328    
1329            public int countAll() throws SystemException {
1330                    Object[] finderArgs = new Object[0];
1331    
1332                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1333                                    finderArgs, this);
1334    
1335                    if (count == null) {
1336                            Session session = null;
1337    
1338                            try {
1339                                    session = openSession();
1340    
1341                                    Query q = session.createQuery(_SQL_COUNT_COUNTRY);
1342    
1343                                    count = (Long)q.uniqueResult();
1344                            }
1345                            catch (Exception e) {
1346                                    throw processException(e);
1347                            }
1348                            finally {
1349                                    if (count == null) {
1350                                            count = Long.valueOf(0);
1351                                    }
1352    
1353                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1354                                            count);
1355    
1356                                    closeSession(session);
1357                            }
1358                    }
1359    
1360                    return count.intValue();
1361            }
1362    
1363            public void afterPropertiesSet() {
1364                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1365                                            com.liferay.portal.util.PropsUtil.get(
1366                                                    "value.object.listener.com.liferay.portal.model.Country")));
1367    
1368                    if (listenerClassNames.length > 0) {
1369                            try {
1370                                    List<ModelListener<Country>> listenersList = new ArrayList<ModelListener<Country>>();
1371    
1372                                    for (String listenerClassName : listenerClassNames) {
1373                                            listenersList.add((ModelListener<Country>)InstanceFactory.newInstance(
1374                                                            listenerClassName));
1375                                    }
1376    
1377                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1378                            }
1379                            catch (Exception e) {
1380                                    _log.error(e);
1381                            }
1382                    }
1383            }
1384    
1385            @BeanReference(type = AccountPersistence.class)
1386            protected AccountPersistence accountPersistence;
1387            @BeanReference(type = AddressPersistence.class)
1388            protected AddressPersistence addressPersistence;
1389            @BeanReference(type = BrowserTrackerPersistence.class)
1390            protected BrowserTrackerPersistence browserTrackerPersistence;
1391            @BeanReference(type = ClassNamePersistence.class)
1392            protected ClassNamePersistence classNamePersistence;
1393            @BeanReference(type = CompanyPersistence.class)
1394            protected CompanyPersistence companyPersistence;
1395            @BeanReference(type = ContactPersistence.class)
1396            protected ContactPersistence contactPersistence;
1397            @BeanReference(type = CountryPersistence.class)
1398            protected CountryPersistence countryPersistence;
1399            @BeanReference(type = EmailAddressPersistence.class)
1400            protected EmailAddressPersistence emailAddressPersistence;
1401            @BeanReference(type = GroupPersistence.class)
1402            protected GroupPersistence groupPersistence;
1403            @BeanReference(type = ImagePersistence.class)
1404            protected ImagePersistence imagePersistence;
1405            @BeanReference(type = LayoutPersistence.class)
1406            protected LayoutPersistence layoutPersistence;
1407            @BeanReference(type = LayoutPrototypePersistence.class)
1408            protected LayoutPrototypePersistence layoutPrototypePersistence;
1409            @BeanReference(type = LayoutSetPersistence.class)
1410            protected LayoutSetPersistence layoutSetPersistence;
1411            @BeanReference(type = LayoutSetPrototypePersistence.class)
1412            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1413            @BeanReference(type = ListTypePersistence.class)
1414            protected ListTypePersistence listTypePersistence;
1415            @BeanReference(type = LockPersistence.class)
1416            protected LockPersistence lockPersistence;
1417            @BeanReference(type = MembershipRequestPersistence.class)
1418            protected MembershipRequestPersistence membershipRequestPersistence;
1419            @BeanReference(type = OrganizationPersistence.class)
1420            protected OrganizationPersistence organizationPersistence;
1421            @BeanReference(type = OrgGroupPermissionPersistence.class)
1422            protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1423            @BeanReference(type = OrgGroupRolePersistence.class)
1424            protected OrgGroupRolePersistence orgGroupRolePersistence;
1425            @BeanReference(type = OrgLaborPersistence.class)
1426            protected OrgLaborPersistence orgLaborPersistence;
1427            @BeanReference(type = PasswordPolicyPersistence.class)
1428            protected PasswordPolicyPersistence passwordPolicyPersistence;
1429            @BeanReference(type = PasswordPolicyRelPersistence.class)
1430            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1431            @BeanReference(type = PasswordTrackerPersistence.class)
1432            protected PasswordTrackerPersistence passwordTrackerPersistence;
1433            @BeanReference(type = PermissionPersistence.class)
1434            protected PermissionPersistence permissionPersistence;
1435            @BeanReference(type = PhonePersistence.class)
1436            protected PhonePersistence phonePersistence;
1437            @BeanReference(type = PluginSettingPersistence.class)
1438            protected PluginSettingPersistence pluginSettingPersistence;
1439            @BeanReference(type = PortletPersistence.class)
1440            protected PortletPersistence portletPersistence;
1441            @BeanReference(type = PortletItemPersistence.class)
1442            protected PortletItemPersistence portletItemPersistence;
1443            @BeanReference(type = PortletPreferencesPersistence.class)
1444            protected PortletPreferencesPersistence portletPreferencesPersistence;
1445            @BeanReference(type = RegionPersistence.class)
1446            protected RegionPersistence regionPersistence;
1447            @BeanReference(type = ReleasePersistence.class)
1448            protected ReleasePersistence releasePersistence;
1449            @BeanReference(type = ResourcePersistence.class)
1450            protected ResourcePersistence resourcePersistence;
1451            @BeanReference(type = ResourceActionPersistence.class)
1452            protected ResourceActionPersistence resourceActionPersistence;
1453            @BeanReference(type = ResourceCodePersistence.class)
1454            protected ResourceCodePersistence resourceCodePersistence;
1455            @BeanReference(type = ResourcePermissionPersistence.class)
1456            protected ResourcePermissionPersistence resourcePermissionPersistence;
1457            @BeanReference(type = RolePersistence.class)
1458            protected RolePersistence rolePersistence;
1459            @BeanReference(type = ServiceComponentPersistence.class)
1460            protected ServiceComponentPersistence serviceComponentPersistence;
1461            @BeanReference(type = ShardPersistence.class)
1462            protected ShardPersistence shardPersistence;
1463            @BeanReference(type = SubscriptionPersistence.class)
1464            protected SubscriptionPersistence subscriptionPersistence;
1465            @BeanReference(type = TicketPersistence.class)
1466            protected TicketPersistence ticketPersistence;
1467            @BeanReference(type = TeamPersistence.class)
1468            protected TeamPersistence teamPersistence;
1469            @BeanReference(type = UserPersistence.class)
1470            protected UserPersistence userPersistence;
1471            @BeanReference(type = UserGroupPersistence.class)
1472            protected UserGroupPersistence userGroupPersistence;
1473            @BeanReference(type = UserGroupGroupRolePersistence.class)
1474            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1475            @BeanReference(type = UserGroupRolePersistence.class)
1476            protected UserGroupRolePersistence userGroupRolePersistence;
1477            @BeanReference(type = UserIdMapperPersistence.class)
1478            protected UserIdMapperPersistence userIdMapperPersistence;
1479            @BeanReference(type = UserTrackerPersistence.class)
1480            protected UserTrackerPersistence userTrackerPersistence;
1481            @BeanReference(type = UserTrackerPathPersistence.class)
1482            protected UserTrackerPathPersistence userTrackerPathPersistence;
1483            @BeanReference(type = WebDAVPropsPersistence.class)
1484            protected WebDAVPropsPersistence webDAVPropsPersistence;
1485            @BeanReference(type = WebsitePersistence.class)
1486            protected WebsitePersistence websitePersistence;
1487            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1488            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1489            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1490            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1491            private static final String _SQL_SELECT_COUNTRY = "SELECT country FROM Country country";
1492            private static final String _SQL_SELECT_COUNTRY_WHERE = "SELECT country FROM Country country WHERE ";
1493            private static final String _SQL_COUNT_COUNTRY = "SELECT COUNT(country) FROM Country country";
1494            private static final String _SQL_COUNT_COUNTRY_WHERE = "SELECT COUNT(country) FROM Country country WHERE ";
1495            private static final String _FINDER_COLUMN_NAME_NAME_1 = "country.name IS NULL";
1496            private static final String _FINDER_COLUMN_NAME_NAME_2 = "country.name = ?";
1497            private static final String _FINDER_COLUMN_NAME_NAME_3 = "(country.name IS NULL OR country.name = ?)";
1498            private static final String _FINDER_COLUMN_A2_A2_1 = "country.a2 IS NULL";
1499            private static final String _FINDER_COLUMN_A2_A2_2 = "country.a2 = ?";
1500            private static final String _FINDER_COLUMN_A2_A2_3 = "(country.a2 IS NULL OR country.a2 = ?)";
1501            private static final String _FINDER_COLUMN_A3_A3_1 = "country.a3 IS NULL";
1502            private static final String _FINDER_COLUMN_A3_A3_2 = "country.a3 = ?";
1503            private static final String _FINDER_COLUMN_A3_A3_3 = "(country.a3 IS NULL OR country.a3 = ?)";
1504            private static final String _FINDER_COLUMN_ACTIVE_ACTIVE_2 = "country.active = ?";
1505            private static final String _ORDER_BY_ENTITY_ALIAS = "country.";
1506            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Country exists with the primary key ";
1507            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Country exists with the key {";
1508            private static Log _log = LogFactoryUtil.getLog(CountryPersistenceImpl.class);
1509    }