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