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