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