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