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.NoSuchModelException;
18  import com.liferay.portal.NoSuchPhoneException;
19  import com.liferay.portal.kernel.annotation.BeanReference;
20  import com.liferay.portal.kernel.cache.CacheRegistry;
21  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
22  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
23  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
24  import com.liferay.portal.kernel.dao.orm.FinderPath;
25  import com.liferay.portal.kernel.dao.orm.Query;
26  import com.liferay.portal.kernel.dao.orm.QueryPos;
27  import com.liferay.portal.kernel.dao.orm.QueryUtil;
28  import com.liferay.portal.kernel.dao.orm.Session;
29  import com.liferay.portal.kernel.exception.SystemException;
30  import com.liferay.portal.kernel.log.Log;
31  import com.liferay.portal.kernel.log.LogFactoryUtil;
32  import com.liferay.portal.kernel.util.GetterUtil;
33  import com.liferay.portal.kernel.util.OrderByComparator;
34  import com.liferay.portal.kernel.util.StringBundler;
35  import com.liferay.portal.kernel.util.StringPool;
36  import com.liferay.portal.kernel.util.StringUtil;
37  import com.liferay.portal.model.ModelListener;
38  import com.liferay.portal.model.Phone;
39  import com.liferay.portal.model.impl.PhoneImpl;
40  import com.liferay.portal.model.impl.PhoneModelImpl;
41  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
42  
43  import java.io.Serializable;
44  
45  import java.util.ArrayList;
46  import java.util.Collections;
47  import java.util.List;
48  
49  /**
50   * <a href="PhonePersistenceImpl.java.html"><b><i>View Source</i></b></a>
51   *
52   * <p>
53   * ServiceBuilder generated this class. Modifications in this class will be
54   * overwritten the next time is generated.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       PhonePersistence
59   * @see       PhoneUtil
60   * @generated
61   */
62  public class PhonePersistenceImpl extends BasePersistenceImpl<Phone>
63      implements PhonePersistence {
64      public static final String FINDER_CLASS_NAME_ENTITY = PhoneImpl.class.getName();
65      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
66          ".List";
67      public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
68              PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
69              "findByCompanyId", new String[] { Long.class.getName() });
70      public static final FinderPath FINDER_PATH_FIND_BY_OBC_COMPANYID = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
71              PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
72              "findByCompanyId",
73              new String[] {
74                  Long.class.getName(),
75                  
76              "java.lang.Integer", "java.lang.Integer",
77                  "com.liferay.portal.kernel.util.OrderByComparator"
78              });
79      public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
80              PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
81              "countByCompanyId", new String[] { Long.class.getName() });
82      public static final FinderPath FINDER_PATH_FIND_BY_USERID = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
83              PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
84              "findByUserId", new String[] { Long.class.getName() });
85      public static final FinderPath FINDER_PATH_FIND_BY_OBC_USERID = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
86              PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
87              "findByUserId",
88              new String[] {
89                  Long.class.getName(),
90                  
91              "java.lang.Integer", "java.lang.Integer",
92                  "com.liferay.portal.kernel.util.OrderByComparator"
93              });
94      public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
95              PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
96              "countByUserId", new String[] { Long.class.getName() });
97      public static final FinderPath FINDER_PATH_FIND_BY_C_C = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
98              PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
99              "findByC_C",
100             new String[] { Long.class.getName(), Long.class.getName() });
101     public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_C = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
102             PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
103             "findByC_C",
104             new String[] {
105                 Long.class.getName(), Long.class.getName(),
106                 
107             "java.lang.Integer", "java.lang.Integer",
108                 "com.liferay.portal.kernel.util.OrderByComparator"
109             });
110     public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
111             PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
112             "countByC_C",
113             new String[] { Long.class.getName(), Long.class.getName() });
114     public static final FinderPath FINDER_PATH_FIND_BY_C_C_C = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
115             PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
116             "findByC_C_C",
117             new String[] {
118                 Long.class.getName(), Long.class.getName(), Long.class.getName()
119             });
120     public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_C_C = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
121             PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
122             "findByC_C_C",
123             new String[] {
124                 Long.class.getName(), Long.class.getName(), Long.class.getName(),
125                 
126             "java.lang.Integer", "java.lang.Integer",
127                 "com.liferay.portal.kernel.util.OrderByComparator"
128             });
129     public static final FinderPath FINDER_PATH_COUNT_BY_C_C_C = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
130             PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
131             "countByC_C_C",
132             new String[] {
133                 Long.class.getName(), Long.class.getName(), Long.class.getName()
134             });
135     public static final FinderPath FINDER_PATH_FIND_BY_C_C_C_P = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
136             PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
137             "findByC_C_C_P",
138             new String[] {
139                 Long.class.getName(), Long.class.getName(), Long.class.getName(),
140                 Boolean.class.getName()
141             });
142     public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_C_C_P = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
143             PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
144             "findByC_C_C_P",
145             new String[] {
146                 Long.class.getName(), Long.class.getName(), Long.class.getName(),
147                 Boolean.class.getName(),
148                 
149             "java.lang.Integer", "java.lang.Integer",
150                 "com.liferay.portal.kernel.util.OrderByComparator"
151             });
152     public static final FinderPath FINDER_PATH_COUNT_BY_C_C_C_P = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
153             PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
154             "countByC_C_C_P",
155             new String[] {
156                 Long.class.getName(), Long.class.getName(), Long.class.getName(),
157                 Boolean.class.getName()
158             });
159     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
160             PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
161             "findAll", new String[0]);
162     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
163             PhoneModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
164             "countAll", new String[0]);
165 
166     public void cacheResult(Phone phone) {
167         EntityCacheUtil.putResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
168             PhoneImpl.class, phone.getPrimaryKey(), phone);
169     }
170 
171     public void cacheResult(List<Phone> phones) {
172         for (Phone phone : phones) {
173             if (EntityCacheUtil.getResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
174                         PhoneImpl.class, phone.getPrimaryKey(), this) == null) {
175                 cacheResult(phone);
176             }
177         }
178     }
179 
180     public void clearCache() {
181         CacheRegistry.clear(PhoneImpl.class.getName());
182         EntityCacheUtil.clearCache(PhoneImpl.class.getName());
183         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
184         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
185     }
186 
187     public Phone create(long phoneId) {
188         Phone phone = new PhoneImpl();
189 
190         phone.setNew(true);
191         phone.setPrimaryKey(phoneId);
192 
193         return phone;
194     }
195 
196     public Phone remove(Serializable primaryKey)
197         throws NoSuchModelException, SystemException {
198         return remove(((Long)primaryKey).longValue());
199     }
200 
201     public Phone remove(long phoneId)
202         throws NoSuchPhoneException, SystemException {
203         Session session = null;
204 
205         try {
206             session = openSession();
207 
208             Phone phone = (Phone)session.get(PhoneImpl.class, new Long(phoneId));
209 
210             if (phone == null) {
211                 if (_log.isWarnEnabled()) {
212                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + phoneId);
213                 }
214 
215                 throw new NoSuchPhoneException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
216                     phoneId);
217             }
218 
219             return remove(phone);
220         }
221         catch (NoSuchPhoneException nsee) {
222             throw nsee;
223         }
224         catch (Exception e) {
225             throw processException(e);
226         }
227         finally {
228             closeSession(session);
229         }
230     }
231 
232     public Phone remove(Phone phone) throws SystemException {
233         for (ModelListener<Phone> listener : listeners) {
234             listener.onBeforeRemove(phone);
235         }
236 
237         phone = removeImpl(phone);
238 
239         for (ModelListener<Phone> listener : listeners) {
240             listener.onAfterRemove(phone);
241         }
242 
243         return phone;
244     }
245 
246     protected Phone removeImpl(Phone phone) throws SystemException {
247         phone = toUnwrappedModel(phone);
248 
249         Session session = null;
250 
251         try {
252             session = openSession();
253 
254             if (phone.isCachedModel() || BatchSessionUtil.isEnabled()) {
255                 Object staleObject = session.get(PhoneImpl.class,
256                         phone.getPrimaryKeyObj());
257 
258                 if (staleObject != null) {
259                     session.evict(staleObject);
260                 }
261             }
262 
263             session.delete(phone);
264 
265             session.flush();
266         }
267         catch (Exception e) {
268             throw processException(e);
269         }
270         finally {
271             closeSession(session);
272         }
273 
274         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
275 
276         EntityCacheUtil.removeResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
277             PhoneImpl.class, phone.getPrimaryKey());
278 
279         return phone;
280     }
281 
282     public Phone updateImpl(com.liferay.portal.model.Phone phone, boolean merge)
283         throws SystemException {
284         phone = toUnwrappedModel(phone);
285 
286         Session session = null;
287 
288         try {
289             session = openSession();
290 
291             BatchSessionUtil.update(session, phone, merge);
292 
293             phone.setNew(false);
294         }
295         catch (Exception e) {
296             throw processException(e);
297         }
298         finally {
299             closeSession(session);
300         }
301 
302         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
303 
304         EntityCacheUtil.putResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
305             PhoneImpl.class, phone.getPrimaryKey(), phone);
306 
307         return phone;
308     }
309 
310     protected Phone toUnwrappedModel(Phone phone) {
311         if (phone instanceof PhoneImpl) {
312             return phone;
313         }
314 
315         PhoneImpl phoneImpl = new PhoneImpl();
316 
317         phoneImpl.setNew(phone.isNew());
318         phoneImpl.setPrimaryKey(phone.getPrimaryKey());
319 
320         phoneImpl.setPhoneId(phone.getPhoneId());
321         phoneImpl.setCompanyId(phone.getCompanyId());
322         phoneImpl.setUserId(phone.getUserId());
323         phoneImpl.setUserName(phone.getUserName());
324         phoneImpl.setCreateDate(phone.getCreateDate());
325         phoneImpl.setModifiedDate(phone.getModifiedDate());
326         phoneImpl.setClassNameId(phone.getClassNameId());
327         phoneImpl.setClassPK(phone.getClassPK());
328         phoneImpl.setNumber(phone.getNumber());
329         phoneImpl.setExtension(phone.getExtension());
330         phoneImpl.setTypeId(phone.getTypeId());
331         phoneImpl.setPrimary(phone.isPrimary());
332 
333         return phoneImpl;
334     }
335 
336     public Phone findByPrimaryKey(Serializable primaryKey)
337         throws NoSuchModelException, SystemException {
338         return findByPrimaryKey(((Long)primaryKey).longValue());
339     }
340 
341     public Phone findByPrimaryKey(long phoneId)
342         throws NoSuchPhoneException, SystemException {
343         Phone phone = fetchByPrimaryKey(phoneId);
344 
345         if (phone == null) {
346             if (_log.isWarnEnabled()) {
347                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + phoneId);
348             }
349 
350             throw new NoSuchPhoneException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
351                 phoneId);
352         }
353 
354         return phone;
355     }
356 
357     public Phone fetchByPrimaryKey(Serializable primaryKey)
358         throws SystemException {
359         return fetchByPrimaryKey(((Long)primaryKey).longValue());
360     }
361 
362     public Phone fetchByPrimaryKey(long phoneId) throws SystemException {
363         Phone phone = (Phone)EntityCacheUtil.getResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
364                 PhoneImpl.class, phoneId, this);
365 
366         if (phone == null) {
367             Session session = null;
368 
369             try {
370                 session = openSession();
371 
372                 phone = (Phone)session.get(PhoneImpl.class, new Long(phoneId));
373             }
374             catch (Exception e) {
375                 throw processException(e);
376             }
377             finally {
378                 if (phone != null) {
379                     cacheResult(phone);
380                 }
381 
382                 closeSession(session);
383             }
384         }
385 
386         return phone;
387     }
388 
389     public List<Phone> findByCompanyId(long companyId)
390         throws SystemException {
391         Object[] finderArgs = new Object[] { new Long(companyId) };
392 
393         List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
394                 finderArgs, this);
395 
396         if (list == null) {
397             Session session = null;
398 
399             try {
400                 session = openSession();
401 
402                 StringBundler query = new StringBundler(3);
403 
404                 query.append(_SQL_SELECT_PHONE_WHERE);
405 
406                 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
407 
408                 query.append(PhoneModelImpl.ORDER_BY_JPQL);
409 
410                 String sql = query.toString();
411 
412                 Query q = session.createQuery(sql);
413 
414                 QueryPos qPos = QueryPos.getInstance(q);
415 
416                 qPos.add(companyId);
417 
418                 list = q.list();
419             }
420             catch (Exception e) {
421                 throw processException(e);
422             }
423             finally {
424                 if (list == null) {
425                     list = new ArrayList<Phone>();
426                 }
427 
428                 cacheResult(list);
429 
430                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
431                     finderArgs, list);
432 
433                 closeSession(session);
434             }
435         }
436 
437         return list;
438     }
439 
440     public List<Phone> findByCompanyId(long companyId, int start, int end)
441         throws SystemException {
442         return findByCompanyId(companyId, start, end, null);
443     }
444 
445     public List<Phone> findByCompanyId(long companyId, int start, int end,
446         OrderByComparator obc) throws SystemException {
447         Object[] finderArgs = new Object[] {
448                 new Long(companyId),
449                 
450                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
451             };
452 
453         List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
454                 finderArgs, this);
455 
456         if (list == null) {
457             Session session = null;
458 
459             try {
460                 session = openSession();
461 
462                 StringBundler query = null;
463 
464                 if (obc != null) {
465                     query = new StringBundler(3 +
466                             (obc.getOrderByFields().length * 3));
467                 }
468                 else {
469                     query = new StringBundler(3);
470                 }
471 
472                 query.append(_SQL_SELECT_PHONE_WHERE);
473 
474                 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
475 
476                 if (obc != null) {
477                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
478                 }
479 
480                 else {
481                     query.append(PhoneModelImpl.ORDER_BY_JPQL);
482                 }
483 
484                 String sql = query.toString();
485 
486                 Query q = session.createQuery(sql);
487 
488                 QueryPos qPos = QueryPos.getInstance(q);
489 
490                 qPos.add(companyId);
491 
492                 list = (List<Phone>)QueryUtil.list(q, getDialect(), start, end);
493             }
494             catch (Exception e) {
495                 throw processException(e);
496             }
497             finally {
498                 if (list == null) {
499                     list = new ArrayList<Phone>();
500                 }
501 
502                 cacheResult(list);
503 
504                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
505                     finderArgs, list);
506 
507                 closeSession(session);
508             }
509         }
510 
511         return list;
512     }
513 
514     public Phone findByCompanyId_First(long companyId, OrderByComparator obc)
515         throws NoSuchPhoneException, SystemException {
516         List<Phone> list = findByCompanyId(companyId, 0, 1, obc);
517 
518         if (list.isEmpty()) {
519             StringBundler msg = new StringBundler(4);
520 
521             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
522 
523             msg.append("companyId=");
524             msg.append(companyId);
525 
526             msg.append(StringPool.CLOSE_CURLY_BRACE);
527 
528             throw new NoSuchPhoneException(msg.toString());
529         }
530         else {
531             return list.get(0);
532         }
533     }
534 
535     public Phone findByCompanyId_Last(long companyId, OrderByComparator obc)
536         throws NoSuchPhoneException, SystemException {
537         int count = countByCompanyId(companyId);
538 
539         List<Phone> list = findByCompanyId(companyId, count - 1, count, obc);
540 
541         if (list.isEmpty()) {
542             StringBundler msg = new StringBundler(4);
543 
544             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
545 
546             msg.append("companyId=");
547             msg.append(companyId);
548 
549             msg.append(StringPool.CLOSE_CURLY_BRACE);
550 
551             throw new NoSuchPhoneException(msg.toString());
552         }
553         else {
554             return list.get(0);
555         }
556     }
557 
558     public Phone[] findByCompanyId_PrevAndNext(long phoneId, long companyId,
559         OrderByComparator obc) throws NoSuchPhoneException, SystemException {
560         Phone phone = findByPrimaryKey(phoneId);
561 
562         int count = countByCompanyId(companyId);
563 
564         Session session = null;
565 
566         try {
567             session = openSession();
568 
569             StringBundler query = null;
570 
571             if (obc != null) {
572                 query = new StringBundler(3 +
573                         (obc.getOrderByFields().length * 3));
574             }
575             else {
576                 query = new StringBundler(3);
577             }
578 
579             query.append(_SQL_SELECT_PHONE_WHERE);
580 
581             query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
582 
583             if (obc != null) {
584                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
585             }
586 
587             else {
588                 query.append(PhoneModelImpl.ORDER_BY_JPQL);
589             }
590 
591             String sql = query.toString();
592 
593             Query q = session.createQuery(sql);
594 
595             QueryPos qPos = QueryPos.getInstance(q);
596 
597             qPos.add(companyId);
598 
599             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, phone);
600 
601             Phone[] array = new PhoneImpl[3];
602 
603             array[0] = (Phone)objArray[0];
604             array[1] = (Phone)objArray[1];
605             array[2] = (Phone)objArray[2];
606 
607             return array;
608         }
609         catch (Exception e) {
610             throw processException(e);
611         }
612         finally {
613             closeSession(session);
614         }
615     }
616 
617     public List<Phone> findByUserId(long userId) throws SystemException {
618         Object[] finderArgs = new Object[] { new Long(userId) };
619 
620         List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID,
621                 finderArgs, this);
622 
623         if (list == null) {
624             Session session = null;
625 
626             try {
627                 session = openSession();
628 
629                 StringBundler query = new StringBundler(3);
630 
631                 query.append(_SQL_SELECT_PHONE_WHERE);
632 
633                 query.append(_FINDER_COLUMN_USERID_USERID_2);
634 
635                 query.append(PhoneModelImpl.ORDER_BY_JPQL);
636 
637                 String sql = query.toString();
638 
639                 Query q = session.createQuery(sql);
640 
641                 QueryPos qPos = QueryPos.getInstance(q);
642 
643                 qPos.add(userId);
644 
645                 list = q.list();
646             }
647             catch (Exception e) {
648                 throw processException(e);
649             }
650             finally {
651                 if (list == null) {
652                     list = new ArrayList<Phone>();
653                 }
654 
655                 cacheResult(list);
656 
657                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID,
658                     finderArgs, list);
659 
660                 closeSession(session);
661             }
662         }
663 
664         return list;
665     }
666 
667     public List<Phone> findByUserId(long userId, int start, int end)
668         throws SystemException {
669         return findByUserId(userId, start, end, null);
670     }
671 
672     public List<Phone> findByUserId(long userId, int start, int end,
673         OrderByComparator obc) throws SystemException {
674         Object[] finderArgs = new Object[] {
675                 new Long(userId),
676                 
677                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
678             };
679 
680         List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_USERID,
681                 finderArgs, this);
682 
683         if (list == null) {
684             Session session = null;
685 
686             try {
687                 session = openSession();
688 
689                 StringBundler query = null;
690 
691                 if (obc != null) {
692                     query = new StringBundler(3 +
693                             (obc.getOrderByFields().length * 3));
694                 }
695                 else {
696                     query = new StringBundler(3);
697                 }
698 
699                 query.append(_SQL_SELECT_PHONE_WHERE);
700 
701                 query.append(_FINDER_COLUMN_USERID_USERID_2);
702 
703                 if (obc != null) {
704                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
705                 }
706 
707                 else {
708                     query.append(PhoneModelImpl.ORDER_BY_JPQL);
709                 }
710 
711                 String sql = query.toString();
712 
713                 Query q = session.createQuery(sql);
714 
715                 QueryPos qPos = QueryPos.getInstance(q);
716 
717                 qPos.add(userId);
718 
719                 list = (List<Phone>)QueryUtil.list(q, getDialect(), start, end);
720             }
721             catch (Exception e) {
722                 throw processException(e);
723             }
724             finally {
725                 if (list == null) {
726                     list = new ArrayList<Phone>();
727                 }
728 
729                 cacheResult(list);
730 
731                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_USERID,
732                     finderArgs, list);
733 
734                 closeSession(session);
735             }
736         }
737 
738         return list;
739     }
740 
741     public Phone findByUserId_First(long userId, OrderByComparator obc)
742         throws NoSuchPhoneException, SystemException {
743         List<Phone> list = findByUserId(userId, 0, 1, obc);
744 
745         if (list.isEmpty()) {
746             StringBundler msg = new StringBundler(4);
747 
748             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
749 
750             msg.append("userId=");
751             msg.append(userId);
752 
753             msg.append(StringPool.CLOSE_CURLY_BRACE);
754 
755             throw new NoSuchPhoneException(msg.toString());
756         }
757         else {
758             return list.get(0);
759         }
760     }
761 
762     public Phone findByUserId_Last(long userId, OrderByComparator obc)
763         throws NoSuchPhoneException, SystemException {
764         int count = countByUserId(userId);
765 
766         List<Phone> list = findByUserId(userId, count - 1, count, obc);
767 
768         if (list.isEmpty()) {
769             StringBundler msg = new StringBundler(4);
770 
771             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
772 
773             msg.append("userId=");
774             msg.append(userId);
775 
776             msg.append(StringPool.CLOSE_CURLY_BRACE);
777 
778             throw new NoSuchPhoneException(msg.toString());
779         }
780         else {
781             return list.get(0);
782         }
783     }
784 
785     public Phone[] findByUserId_PrevAndNext(long phoneId, long userId,
786         OrderByComparator obc) throws NoSuchPhoneException, SystemException {
787         Phone phone = findByPrimaryKey(phoneId);
788 
789         int count = countByUserId(userId);
790 
791         Session session = null;
792 
793         try {
794             session = openSession();
795 
796             StringBundler query = null;
797 
798             if (obc != null) {
799                 query = new StringBundler(3 +
800                         (obc.getOrderByFields().length * 3));
801             }
802             else {
803                 query = new StringBundler(3);
804             }
805 
806             query.append(_SQL_SELECT_PHONE_WHERE);
807 
808             query.append(_FINDER_COLUMN_USERID_USERID_2);
809 
810             if (obc != null) {
811                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
812             }
813 
814             else {
815                 query.append(PhoneModelImpl.ORDER_BY_JPQL);
816             }
817 
818             String sql = query.toString();
819 
820             Query q = session.createQuery(sql);
821 
822             QueryPos qPos = QueryPos.getInstance(q);
823 
824             qPos.add(userId);
825 
826             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, phone);
827 
828             Phone[] array = new PhoneImpl[3];
829 
830             array[0] = (Phone)objArray[0];
831             array[1] = (Phone)objArray[1];
832             array[2] = (Phone)objArray[2];
833 
834             return array;
835         }
836         catch (Exception e) {
837             throw processException(e);
838         }
839         finally {
840             closeSession(session);
841         }
842     }
843 
844     public List<Phone> findByC_C(long companyId, long classNameId)
845         throws SystemException {
846         Object[] finderArgs = new Object[] {
847                 new Long(companyId), new Long(classNameId)
848             };
849 
850         List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_C,
851                 finderArgs, this);
852 
853         if (list == null) {
854             Session session = null;
855 
856             try {
857                 session = openSession();
858 
859                 StringBundler query = new StringBundler(4);
860 
861                 query.append(_SQL_SELECT_PHONE_WHERE);
862 
863                 query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
864 
865                 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
866 
867                 query.append(PhoneModelImpl.ORDER_BY_JPQL);
868 
869                 String sql = query.toString();
870 
871                 Query q = session.createQuery(sql);
872 
873                 QueryPos qPos = QueryPos.getInstance(q);
874 
875                 qPos.add(companyId);
876 
877                 qPos.add(classNameId);
878 
879                 list = q.list();
880             }
881             catch (Exception e) {
882                 throw processException(e);
883             }
884             finally {
885                 if (list == null) {
886                     list = new ArrayList<Phone>();
887                 }
888 
889                 cacheResult(list);
890 
891                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_C, finderArgs,
892                     list);
893 
894                 closeSession(session);
895             }
896         }
897 
898         return list;
899     }
900 
901     public List<Phone> findByC_C(long companyId, long classNameId, int start,
902         int end) throws SystemException {
903         return findByC_C(companyId, classNameId, start, end, null);
904     }
905 
906     public List<Phone> findByC_C(long companyId, long classNameId, int start,
907         int end, OrderByComparator obc) throws SystemException {
908         Object[] finderArgs = new Object[] {
909                 new Long(companyId), new Long(classNameId),
910                 
911                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
912             };
913 
914         List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_C,
915                 finderArgs, this);
916 
917         if (list == null) {
918             Session session = null;
919 
920             try {
921                 session = openSession();
922 
923                 StringBundler query = null;
924 
925                 if (obc != null) {
926                     query = new StringBundler(4 +
927                             (obc.getOrderByFields().length * 3));
928                 }
929                 else {
930                     query = new StringBundler(4);
931                 }
932 
933                 query.append(_SQL_SELECT_PHONE_WHERE);
934 
935                 query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
936 
937                 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
938 
939                 if (obc != null) {
940                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
941                 }
942 
943                 else {
944                     query.append(PhoneModelImpl.ORDER_BY_JPQL);
945                 }
946 
947                 String sql = query.toString();
948 
949                 Query q = session.createQuery(sql);
950 
951                 QueryPos qPos = QueryPos.getInstance(q);
952 
953                 qPos.add(companyId);
954 
955                 qPos.add(classNameId);
956 
957                 list = (List<Phone>)QueryUtil.list(q, getDialect(), start, end);
958             }
959             catch (Exception e) {
960                 throw processException(e);
961             }
962             finally {
963                 if (list == null) {
964                     list = new ArrayList<Phone>();
965                 }
966 
967                 cacheResult(list);
968 
969                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_C,
970                     finderArgs, list);
971 
972                 closeSession(session);
973             }
974         }
975 
976         return list;
977     }
978 
979     public Phone findByC_C_First(long companyId, long classNameId,
980         OrderByComparator obc) throws NoSuchPhoneException, SystemException {
981         List<Phone> list = findByC_C(companyId, classNameId, 0, 1, obc);
982 
983         if (list.isEmpty()) {
984             StringBundler msg = new StringBundler(6);
985 
986             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
987 
988             msg.append("companyId=");
989             msg.append(companyId);
990 
991             msg.append(", classNameId=");
992             msg.append(classNameId);
993 
994             msg.append(StringPool.CLOSE_CURLY_BRACE);
995 
996             throw new NoSuchPhoneException(msg.toString());
997         }
998         else {
999             return list.get(0);
1000        }
1001    }
1002
1003    public Phone findByC_C_Last(long companyId, long classNameId,
1004        OrderByComparator obc) throws NoSuchPhoneException, SystemException {
1005        int count = countByC_C(companyId, classNameId);
1006
1007        List<Phone> list = findByC_C(companyId, classNameId, count - 1, count,
1008                obc);
1009
1010        if (list.isEmpty()) {
1011            StringBundler msg = new StringBundler(6);
1012
1013            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1014
1015            msg.append("companyId=");
1016            msg.append(companyId);
1017
1018            msg.append(", classNameId=");
1019            msg.append(classNameId);
1020
1021            msg.append(StringPool.CLOSE_CURLY_BRACE);
1022
1023            throw new NoSuchPhoneException(msg.toString());
1024        }
1025        else {
1026            return list.get(0);
1027        }
1028    }
1029
1030    public Phone[] findByC_C_PrevAndNext(long phoneId, long companyId,
1031        long classNameId, OrderByComparator obc)
1032        throws NoSuchPhoneException, SystemException {
1033        Phone phone = findByPrimaryKey(phoneId);
1034
1035        int count = countByC_C(companyId, classNameId);
1036
1037        Session session = null;
1038
1039        try {
1040            session = openSession();
1041
1042            StringBundler query = null;
1043
1044            if (obc != null) {
1045                query = new StringBundler(4 +
1046                        (obc.getOrderByFields().length * 3));
1047            }
1048            else {
1049                query = new StringBundler(4);
1050            }
1051
1052            query.append(_SQL_SELECT_PHONE_WHERE);
1053
1054            query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
1055
1056            query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1057
1058            if (obc != null) {
1059                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1060            }
1061
1062            else {
1063                query.append(PhoneModelImpl.ORDER_BY_JPQL);
1064            }
1065
1066            String sql = query.toString();
1067
1068            Query q = session.createQuery(sql);
1069
1070            QueryPos qPos = QueryPos.getInstance(q);
1071
1072            qPos.add(companyId);
1073
1074            qPos.add(classNameId);
1075
1076            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, phone);
1077
1078            Phone[] array = new PhoneImpl[3];
1079
1080            array[0] = (Phone)objArray[0];
1081            array[1] = (Phone)objArray[1];
1082            array[2] = (Phone)objArray[2];
1083
1084            return array;
1085        }
1086        catch (Exception e) {
1087            throw processException(e);
1088        }
1089        finally {
1090            closeSession(session);
1091        }
1092    }
1093
1094    public List<Phone> findByC_C_C(long companyId, long classNameId,
1095        long classPK) throws SystemException {
1096        Object[] finderArgs = new Object[] {
1097                new Long(companyId), new Long(classNameId), new Long(classPK)
1098            };
1099
1100        List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_C_C,
1101                finderArgs, this);
1102
1103        if (list == null) {
1104            Session session = null;
1105
1106            try {
1107                session = openSession();
1108
1109                StringBundler query = new StringBundler(5);
1110
1111                query.append(_SQL_SELECT_PHONE_WHERE);
1112
1113                query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
1114
1115                query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
1116
1117                query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
1118
1119                query.append(PhoneModelImpl.ORDER_BY_JPQL);
1120
1121                String sql = query.toString();
1122
1123                Query q = session.createQuery(sql);
1124
1125                QueryPos qPos = QueryPos.getInstance(q);
1126
1127                qPos.add(companyId);
1128
1129                qPos.add(classNameId);
1130
1131                qPos.add(classPK);
1132
1133                list = q.list();
1134            }
1135            catch (Exception e) {
1136                throw processException(e);
1137            }
1138            finally {
1139                if (list == null) {
1140                    list = new ArrayList<Phone>();
1141                }
1142
1143                cacheResult(list);
1144
1145                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_C_C,
1146                    finderArgs, list);
1147
1148                closeSession(session);
1149            }
1150        }
1151
1152        return list;
1153    }
1154
1155    public List<Phone> findByC_C_C(long companyId, long classNameId,
1156        long classPK, int start, int end) throws SystemException {
1157        return findByC_C_C(companyId, classNameId, classPK, start, end, null);
1158    }
1159
1160    public List<Phone> findByC_C_C(long companyId, long classNameId,
1161        long classPK, int start, int end, OrderByComparator obc)
1162        throws SystemException {
1163        Object[] finderArgs = new Object[] {
1164                new Long(companyId), new Long(classNameId), new Long(classPK),
1165                
1166                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1167            };
1168
1169        List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_C_C,
1170                finderArgs, this);
1171
1172        if (list == null) {
1173            Session session = null;
1174
1175            try {
1176                session = openSession();
1177
1178                StringBundler query = null;
1179
1180                if (obc != null) {
1181                    query = new StringBundler(5 +
1182                            (obc.getOrderByFields().length * 3));
1183                }
1184                else {
1185                    query = new StringBundler(5);
1186                }
1187
1188                query.append(_SQL_SELECT_PHONE_WHERE);
1189
1190                query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
1191
1192                query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
1193
1194                query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
1195
1196                if (obc != null) {
1197                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1198                }
1199
1200                else {
1201                    query.append(PhoneModelImpl.ORDER_BY_JPQL);
1202                }
1203
1204                String sql = query.toString();
1205
1206                Query q = session.createQuery(sql);
1207
1208                QueryPos qPos = QueryPos.getInstance(q);
1209
1210                qPos.add(companyId);
1211
1212                qPos.add(classNameId);
1213
1214                qPos.add(classPK);
1215
1216                list = (List<Phone>)QueryUtil.list(q, getDialect(), start, end);
1217            }
1218            catch (Exception e) {
1219                throw processException(e);
1220            }
1221            finally {
1222                if (list == null) {
1223                    list = new ArrayList<Phone>();
1224                }
1225
1226                cacheResult(list);
1227
1228                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_C_C,
1229                    finderArgs, list);
1230
1231                closeSession(session);
1232            }
1233        }
1234
1235        return list;
1236    }
1237
1238    public Phone findByC_C_C_First(long companyId, long classNameId,
1239        long classPK, OrderByComparator obc)
1240        throws NoSuchPhoneException, SystemException {
1241        List<Phone> list = findByC_C_C(companyId, classNameId, classPK, 0, 1,
1242                obc);
1243
1244        if (list.isEmpty()) {
1245            StringBundler msg = new StringBundler(8);
1246
1247            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1248
1249            msg.append("companyId=");
1250            msg.append(companyId);
1251
1252            msg.append(", classNameId=");
1253            msg.append(classNameId);
1254
1255            msg.append(", classPK=");
1256            msg.append(classPK);
1257
1258            msg.append(StringPool.CLOSE_CURLY_BRACE);
1259
1260            throw new NoSuchPhoneException(msg.toString());
1261        }
1262        else {
1263            return list.get(0);
1264        }
1265    }
1266
1267    public Phone findByC_C_C_Last(long companyId, long classNameId,
1268        long classPK, OrderByComparator obc)
1269        throws NoSuchPhoneException, SystemException {
1270        int count = countByC_C_C(companyId, classNameId, classPK);
1271
1272        List<Phone> list = findByC_C_C(companyId, classNameId, classPK,
1273                count - 1, count, obc);
1274
1275        if (list.isEmpty()) {
1276            StringBundler msg = new StringBundler(8);
1277
1278            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1279
1280            msg.append("companyId=");
1281            msg.append(companyId);
1282
1283            msg.append(", classNameId=");
1284            msg.append(classNameId);
1285
1286            msg.append(", classPK=");
1287            msg.append(classPK);
1288
1289            msg.append(StringPool.CLOSE_CURLY_BRACE);
1290
1291            throw new NoSuchPhoneException(msg.toString());
1292        }
1293        else {
1294            return list.get(0);
1295        }
1296    }
1297
1298    public Phone[] findByC_C_C_PrevAndNext(long phoneId, long companyId,
1299        long classNameId, long classPK, OrderByComparator obc)
1300        throws NoSuchPhoneException, SystemException {
1301        Phone phone = findByPrimaryKey(phoneId);
1302
1303        int count = countByC_C_C(companyId, classNameId, classPK);
1304
1305        Session session = null;
1306
1307        try {
1308            session = openSession();
1309
1310            StringBundler query = null;
1311
1312            if (obc != null) {
1313                query = new StringBundler(5 +
1314                        (obc.getOrderByFields().length * 3));
1315            }
1316            else {
1317                query = new StringBundler(5);
1318            }
1319
1320            query.append(_SQL_SELECT_PHONE_WHERE);
1321
1322            query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
1323
1324            query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
1325
1326            query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
1327
1328            if (obc != null) {
1329                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1330            }
1331
1332            else {
1333                query.append(PhoneModelImpl.ORDER_BY_JPQL);
1334            }
1335
1336            String sql = query.toString();
1337
1338            Query q = session.createQuery(sql);
1339
1340            QueryPos qPos = QueryPos.getInstance(q);
1341
1342            qPos.add(companyId);
1343
1344            qPos.add(classNameId);
1345
1346            qPos.add(classPK);
1347
1348            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, phone);
1349
1350            Phone[] array = new PhoneImpl[3];
1351
1352            array[0] = (Phone)objArray[0];
1353            array[1] = (Phone)objArray[1];
1354            array[2] = (Phone)objArray[2];
1355
1356            return array;
1357        }
1358        catch (Exception e) {
1359            throw processException(e);
1360        }
1361        finally {
1362            closeSession(session);
1363        }
1364    }
1365
1366    public List<Phone> findByC_C_C_P(long companyId, long classNameId,
1367        long classPK, boolean primary) throws SystemException {
1368        Object[] finderArgs = new Object[] {
1369                new Long(companyId), new Long(classNameId), new Long(classPK),
1370                Boolean.valueOf(primary)
1371            };
1372
1373        List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_C_C_P,
1374                finderArgs, this);
1375
1376        if (list == null) {
1377            Session session = null;
1378
1379            try {
1380                session = openSession();
1381
1382                StringBundler query = new StringBundler(6);
1383
1384                query.append(_SQL_SELECT_PHONE_WHERE);
1385
1386                query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
1387
1388                query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
1389
1390                query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
1391
1392                query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
1393
1394                query.append(PhoneModelImpl.ORDER_BY_JPQL);
1395
1396                String sql = query.toString();
1397
1398                Query q = session.createQuery(sql);
1399
1400                QueryPos qPos = QueryPos.getInstance(q);
1401
1402                qPos.add(companyId);
1403
1404                qPos.add(classNameId);
1405
1406                qPos.add(classPK);
1407
1408                qPos.add(primary);
1409
1410                list = q.list();
1411            }
1412            catch (Exception e) {
1413                throw processException(e);
1414            }
1415            finally {
1416                if (list == null) {
1417                    list = new ArrayList<Phone>();
1418                }
1419
1420                cacheResult(list);
1421
1422                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_C_C_P,
1423                    finderArgs, list);
1424
1425                closeSession(session);
1426            }
1427        }
1428
1429        return list;
1430    }
1431
1432    public List<Phone> findByC_C_C_P(long companyId, long classNameId,
1433        long classPK, boolean primary, int start, int end)
1434        throws SystemException {
1435        return findByC_C_C_P(companyId, classNameId, classPK, primary, start,
1436            end, null);
1437    }
1438
1439    public List<Phone> findByC_C_C_P(long companyId, long classNameId,
1440        long classPK, boolean primary, int start, int end, OrderByComparator obc)
1441        throws SystemException {
1442        Object[] finderArgs = new Object[] {
1443                new Long(companyId), new Long(classNameId), new Long(classPK),
1444                Boolean.valueOf(primary),
1445                
1446                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1447            };
1448
1449        List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_C_C_P,
1450                finderArgs, this);
1451
1452        if (list == null) {
1453            Session session = null;
1454
1455            try {
1456                session = openSession();
1457
1458                StringBundler query = null;
1459
1460                if (obc != null) {
1461                    query = new StringBundler(6 +
1462                            (obc.getOrderByFields().length * 3));
1463                }
1464                else {
1465                    query = new StringBundler(6);
1466                }
1467
1468                query.append(_SQL_SELECT_PHONE_WHERE);
1469
1470                query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
1471
1472                query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
1473
1474                query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
1475
1476                query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
1477
1478                if (obc != null) {
1479                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1480                }
1481
1482                else {
1483                    query.append(PhoneModelImpl.ORDER_BY_JPQL);
1484                }
1485
1486                String sql = query.toString();
1487
1488                Query q = session.createQuery(sql);
1489
1490                QueryPos qPos = QueryPos.getInstance(q);
1491
1492                qPos.add(companyId);
1493
1494                qPos.add(classNameId);
1495
1496                qPos.add(classPK);
1497
1498                qPos.add(primary);
1499
1500                list = (List<Phone>)QueryUtil.list(q, getDialect(), start, end);
1501            }
1502            catch (Exception e) {
1503                throw processException(e);
1504            }
1505            finally {
1506                if (list == null) {
1507                    list = new ArrayList<Phone>();
1508                }
1509
1510                cacheResult(list);
1511
1512                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_C_C_P,
1513                    finderArgs, list);
1514
1515                closeSession(session);
1516            }
1517        }
1518
1519        return list;
1520    }
1521
1522    public Phone findByC_C_C_P_First(long companyId, long classNameId,
1523        long classPK, boolean primary, OrderByComparator obc)
1524        throws NoSuchPhoneException, SystemException {
1525        List<Phone> list = findByC_C_C_P(companyId, classNameId, classPK,
1526                primary, 0, 1, obc);
1527
1528        if (list.isEmpty()) {
1529            StringBundler msg = new StringBundler(10);
1530
1531            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1532
1533            msg.append("companyId=");
1534            msg.append(companyId);
1535
1536            msg.append(", classNameId=");
1537            msg.append(classNameId);
1538
1539            msg.append(", classPK=");
1540            msg.append(classPK);
1541
1542            msg.append(", primary=");
1543            msg.append(primary);
1544
1545            msg.append(StringPool.CLOSE_CURLY_BRACE);
1546
1547            throw new NoSuchPhoneException(msg.toString());
1548        }
1549        else {
1550            return list.get(0);
1551        }
1552    }
1553
1554    public Phone findByC_C_C_P_Last(long companyId, long classNameId,
1555        long classPK, boolean primary, OrderByComparator obc)
1556        throws NoSuchPhoneException, SystemException {
1557        int count = countByC_C_C_P(companyId, classNameId, classPK, primary);
1558
1559        List<Phone> list = findByC_C_C_P(companyId, classNameId, classPK,
1560                primary, count - 1, count, obc);
1561
1562        if (list.isEmpty()) {
1563            StringBundler msg = new StringBundler(10);
1564
1565            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1566
1567            msg.append("companyId=");
1568            msg.append(companyId);
1569
1570            msg.append(", classNameId=");
1571            msg.append(classNameId);
1572
1573            msg.append(", classPK=");
1574            msg.append(classPK);
1575
1576            msg.append(", primary=");
1577            msg.append(primary);
1578
1579            msg.append(StringPool.CLOSE_CURLY_BRACE);
1580
1581            throw new NoSuchPhoneException(msg.toString());
1582        }
1583        else {
1584            return list.get(0);
1585        }
1586    }
1587
1588    public Phone[] findByC_C_C_P_PrevAndNext(long phoneId, long companyId,
1589        long classNameId, long classPK, boolean primary, OrderByComparator obc)
1590        throws NoSuchPhoneException, SystemException {
1591        Phone phone = findByPrimaryKey(phoneId);
1592
1593        int count = countByC_C_C_P(companyId, classNameId, classPK, primary);
1594
1595        Session session = null;
1596
1597        try {
1598            session = openSession();
1599
1600            StringBundler query = null;
1601
1602            if (obc != null) {
1603                query = new StringBundler(6 +
1604                        (obc.getOrderByFields().length * 3));
1605            }
1606            else {
1607                query = new StringBundler(6);
1608            }
1609
1610            query.append(_SQL_SELECT_PHONE_WHERE);
1611
1612            query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
1613
1614            query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
1615
1616            query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
1617
1618            query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
1619
1620            if (obc != null) {
1621                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1622            }
1623
1624            else {
1625                query.append(PhoneModelImpl.ORDER_BY_JPQL);
1626            }
1627
1628            String sql = query.toString();
1629
1630            Query q = session.createQuery(sql);
1631
1632            QueryPos qPos = QueryPos.getInstance(q);
1633
1634            qPos.add(companyId);
1635
1636            qPos.add(classNameId);
1637
1638            qPos.add(classPK);
1639
1640            qPos.add(primary);
1641
1642            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, phone);
1643
1644            Phone[] array = new PhoneImpl[3];
1645
1646            array[0] = (Phone)objArray[0];
1647            array[1] = (Phone)objArray[1];
1648            array[2] = (Phone)objArray[2];
1649
1650            return array;
1651        }
1652        catch (Exception e) {
1653            throw processException(e);
1654        }
1655        finally {
1656            closeSession(session);
1657        }
1658    }
1659
1660    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
1661        throws SystemException {
1662        Session session = null;
1663
1664        try {
1665            session = openSession();
1666
1667            dynamicQuery.compile(session);
1668
1669            return dynamicQuery.list();
1670        }
1671        catch (Exception e) {
1672            throw processException(e);
1673        }
1674        finally {
1675            closeSession(session);
1676        }
1677    }
1678
1679    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
1680        int start, int end) throws SystemException {
1681        Session session = null;
1682
1683        try {
1684            session = openSession();
1685
1686            dynamicQuery.setLimit(start, end);
1687
1688            dynamicQuery.compile(session);
1689
1690            return dynamicQuery.list();
1691        }
1692        catch (Exception e) {
1693            throw processException(e);
1694        }
1695        finally {
1696            closeSession(session);
1697        }
1698    }
1699
1700    public List<Phone> findAll() throws SystemException {
1701        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1702    }
1703
1704    public List<Phone> findAll(int start, int end) throws SystemException {
1705        return findAll(start, end, null);
1706    }
1707
1708    public List<Phone> findAll(int start, int end, OrderByComparator obc)
1709        throws SystemException {
1710        Object[] finderArgs = new Object[] {
1711                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1712            };
1713
1714        List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1715                finderArgs, this);
1716
1717        if (list == null) {
1718            Session session = null;
1719
1720            try {
1721                session = openSession();
1722
1723                StringBundler query = null;
1724                String sql = null;
1725
1726                if (obc != null) {
1727                    query = new StringBundler(2 +
1728                            (obc.getOrderByFields().length * 3));
1729
1730                    query.append(_SQL_SELECT_PHONE);
1731
1732                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1733
1734                    sql = query.toString();
1735                }
1736
1737                else {
1738                    sql = _SQL_SELECT_PHONE.concat(PhoneModelImpl.ORDER_BY_JPQL);
1739                }
1740
1741                Query q = session.createQuery(sql);
1742
1743                if (obc == null) {
1744                    list = (List<Phone>)QueryUtil.list(q, getDialect(), start,
1745                            end, false);
1746
1747                    Collections.sort(list);
1748                }
1749                else {
1750                    list = (List<Phone>)QueryUtil.list(q, getDialect(), start,
1751                            end);
1752                }
1753            }
1754            catch (Exception e) {
1755                throw processException(e);
1756            }
1757            finally {
1758                if (list == null) {
1759                    list = new ArrayList<Phone>();
1760                }
1761
1762                cacheResult(list);
1763
1764                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1765
1766                closeSession(session);
1767            }
1768        }
1769
1770        return list;
1771    }
1772
1773    public void removeByCompanyId(long companyId) throws SystemException {
1774        for (Phone phone : findByCompanyId(companyId)) {
1775            remove(phone);
1776        }
1777    }
1778
1779    public void removeByUserId(long userId) throws SystemException {
1780        for (Phone phone : findByUserId(userId)) {
1781            remove(phone);
1782        }
1783    }
1784
1785    public void removeByC_C(long companyId, long classNameId)
1786        throws SystemException {
1787        for (Phone phone : findByC_C(companyId, classNameId)) {
1788            remove(phone);
1789        }
1790    }
1791
1792    public void removeByC_C_C(long companyId, long classNameId, long classPK)
1793        throws SystemException {
1794        for (Phone phone : findByC_C_C(companyId, classNameId, classPK)) {
1795            remove(phone);
1796        }
1797    }
1798
1799    public void removeByC_C_C_P(long companyId, long classNameId, long classPK,
1800        boolean primary) throws SystemException {
1801        for (Phone phone : findByC_C_C_P(companyId, classNameId, classPK,
1802                primary)) {
1803            remove(phone);
1804        }
1805    }
1806
1807    public void removeAll() throws SystemException {
1808        for (Phone phone : findAll()) {
1809            remove(phone);
1810        }
1811    }
1812
1813    public int countByCompanyId(long companyId) throws SystemException {
1814        Object[] finderArgs = new Object[] { new Long(companyId) };
1815
1816        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
1817                finderArgs, this);
1818
1819        if (count == null) {
1820            Session session = null;
1821
1822            try {
1823                session = openSession();
1824
1825                StringBundler query = new StringBundler(2);
1826
1827                query.append(_SQL_COUNT_PHONE_WHERE);
1828
1829                query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1830
1831                String sql = query.toString();
1832
1833                Query q = session.createQuery(sql);
1834
1835                QueryPos qPos = QueryPos.getInstance(q);
1836
1837                qPos.add(companyId);
1838
1839                count = (Long)q.uniqueResult();
1840            }
1841            catch (Exception e) {
1842                throw processException(e);
1843            }
1844            finally {
1845                if (count == null) {
1846                    count = Long.valueOf(0);
1847                }
1848
1849                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
1850                    finderArgs, count);
1851
1852                closeSession(session);
1853            }
1854        }
1855
1856        return count.intValue();
1857    }
1858
1859    public int countByUserId(long userId) throws SystemException {
1860        Object[] finderArgs = new Object[] { new Long(userId) };
1861
1862        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
1863                finderArgs, this);
1864
1865        if (count == null) {
1866            Session session = null;
1867
1868            try {
1869                session = openSession();
1870
1871                StringBundler query = new StringBundler(2);
1872
1873                query.append(_SQL_COUNT_PHONE_WHERE);
1874
1875                query.append(_FINDER_COLUMN_USERID_USERID_2);
1876
1877                String sql = query.toString();
1878
1879                Query q = session.createQuery(sql);
1880
1881                QueryPos qPos = QueryPos.getInstance(q);
1882
1883                qPos.add(userId);
1884
1885                count = (Long)q.uniqueResult();
1886            }
1887            catch (Exception e) {
1888                throw processException(e);
1889            }
1890            finally {
1891                if (count == null) {
1892                    count = Long.valueOf(0);
1893                }
1894
1895                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
1896                    finderArgs, count);
1897
1898                closeSession(session);
1899            }
1900        }
1901
1902        return count.intValue();
1903    }
1904
1905    public int countByC_C(long companyId, long classNameId)
1906        throws SystemException {
1907        Object[] finderArgs = new Object[] {
1908                new Long(companyId), new Long(classNameId)
1909            };
1910
1911        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
1912                finderArgs, this);
1913
1914        if (count == null) {
1915            Session session = null;
1916
1917            try {
1918                session = openSession();
1919
1920                StringBundler query = new StringBundler(3);
1921
1922                query.append(_SQL_COUNT_PHONE_WHERE);
1923
1924                query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
1925
1926                query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1927
1928                String sql = query.toString();
1929
1930                Query q = session.createQuery(sql);
1931
1932                QueryPos qPos = QueryPos.getInstance(q);
1933
1934                qPos.add(companyId);
1935
1936                qPos.add(classNameId);
1937
1938                count = (Long)q.uniqueResult();
1939            }
1940            catch (Exception e) {
1941                throw processException(e);
1942            }
1943            finally {
1944                if (count == null) {
1945                    count = Long.valueOf(0);
1946                }
1947
1948                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
1949                    count);
1950
1951                closeSession(session);
1952            }
1953        }
1954
1955        return count.intValue();
1956    }
1957
1958    public int countByC_C_C(long companyId, long classNameId, long classPK)
1959        throws SystemException {
1960        Object[] finderArgs = new Object[] {
1961                new Long(companyId), new Long(classNameId), new Long(classPK)
1962            };
1963
1964        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_C,
1965                finderArgs, this);
1966
1967        if (count == null) {
1968            Session session = null;
1969
1970            try {
1971                session = openSession();
1972
1973                StringBundler query = new StringBundler(4);
1974
1975                query.append(_SQL_COUNT_PHONE_WHERE);
1976
1977                query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
1978
1979                query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
1980
1981                query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
1982
1983                String sql = query.toString();
1984
1985                Query q = session.createQuery(sql);
1986
1987                QueryPos qPos = QueryPos.getInstance(q);
1988
1989                qPos.add(companyId);
1990
1991                qPos.add(classNameId);
1992
1993                qPos.add(classPK);
1994
1995                count = (Long)q.uniqueResult();
1996            }
1997            catch (Exception e) {
1998                throw processException(e);
1999            }
2000            finally {
2001                if (count == null) {
2002                    count = Long.valueOf(0);
2003                }
2004
2005                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_C,
2006                    finderArgs, count);
2007
2008                closeSession(session);
2009            }
2010        }
2011
2012        return count.intValue();
2013    }
2014
2015    public int countByC_C_C_P(long companyId, long classNameId, long classPK,
2016        boolean primary) throws SystemException {
2017        Object[] finderArgs = new Object[] {
2018                new Long(companyId), new Long(classNameId), new Long(classPK),
2019                Boolean.valueOf(primary)
2020            };
2021
2022        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_C_P,
2023                finderArgs, this);
2024
2025        if (count == null) {
2026            Session session = null;
2027
2028            try {
2029                session = openSession();
2030
2031                StringBundler query = new StringBundler(5);
2032
2033                query.append(_SQL_COUNT_PHONE_WHERE);
2034
2035                query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
2036
2037                query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
2038
2039                query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
2040
2041                query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
2042
2043                String sql = query.toString();
2044
2045                Query q = session.createQuery(sql);
2046
2047                QueryPos qPos = QueryPos.getInstance(q);
2048
2049                qPos.add(companyId);
2050
2051                qPos.add(classNameId);
2052
2053                qPos.add(classPK);
2054
2055                qPos.add(primary);
2056
2057                count = (Long)q.uniqueResult();
2058            }
2059            catch (Exception e) {
2060                throw processException(e);
2061            }
2062            finally {
2063                if (count == null) {
2064                    count = Long.valueOf(0);
2065                }
2066
2067                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_C_P,
2068                    finderArgs, count);
2069
2070                closeSession(session);
2071            }
2072        }
2073
2074        return count.intValue();
2075    }
2076
2077    public int countAll() throws SystemException {
2078        Object[] finderArgs = new Object[0];
2079
2080        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2081                finderArgs, this);
2082
2083        if (count == null) {
2084            Session session = null;
2085
2086            try {
2087                session = openSession();
2088
2089                Query q = session.createQuery(_SQL_COUNT_PHONE);
2090
2091                count = (Long)q.uniqueResult();
2092            }
2093            catch (Exception e) {
2094                throw processException(e);
2095            }
2096            finally {
2097                if (count == null) {
2098                    count = Long.valueOf(0);
2099                }
2100
2101                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2102                    count);
2103
2104                closeSession(session);
2105            }
2106        }
2107
2108        return count.intValue();
2109    }
2110
2111    public void afterPropertiesSet() {
2112        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2113                    com.liferay.portal.util.PropsUtil.get(
2114                        "value.object.listener.com.liferay.portal.model.Phone")));
2115
2116        if (listenerClassNames.length > 0) {
2117            try {
2118                List<ModelListener<Phone>> listenersList = new ArrayList<ModelListener<Phone>>();
2119
2120                for (String listenerClassName : listenerClassNames) {
2121                    listenersList.add((ModelListener<Phone>)Class.forName(
2122                            listenerClassName).newInstance());
2123                }
2124
2125                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2126            }
2127            catch (Exception e) {
2128                _log.error(e);
2129            }
2130        }
2131    }
2132
2133    @BeanReference(name = "com.liferay.portal.service.persistence.AccountPersistence")
2134    protected com.liferay.portal.service.persistence.AccountPersistence accountPersistence;
2135    @BeanReference(name = "com.liferay.portal.service.persistence.AddressPersistence")
2136    protected com.liferay.portal.service.persistence.AddressPersistence addressPersistence;
2137    @BeanReference(name = "com.liferay.portal.service.persistence.BrowserTrackerPersistence")
2138    protected com.liferay.portal.service.persistence.BrowserTrackerPersistence browserTrackerPersistence;
2139    @BeanReference(name = "com.liferay.portal.service.persistence.ClassNamePersistence")
2140    protected com.liferay.portal.service.persistence.ClassNamePersistence classNamePersistence;
2141    @BeanReference(name = "com.liferay.portal.service.persistence.CompanyPersistence")
2142    protected com.liferay.portal.service.persistence.CompanyPersistence companyPersistence;
2143    @BeanReference(name = "com.liferay.portal.service.persistence.ContactPersistence")
2144    protected com.liferay.portal.service.persistence.ContactPersistence contactPersistence;
2145    @BeanReference(name = "com.liferay.portal.service.persistence.CountryPersistence")
2146    protected com.liferay.portal.service.persistence.CountryPersistence countryPersistence;
2147    @BeanReference(name = "com.liferay.portal.service.persistence.EmailAddressPersistence")
2148    protected com.liferay.portal.service.persistence.EmailAddressPersistence emailAddressPersistence;
2149    @BeanReference(name = "com.liferay.portal.service.persistence.GroupPersistence")
2150    protected com.liferay.portal.service.persistence.GroupPersistence groupPersistence;
2151    @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence")
2152    protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
2153    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPersistence")
2154    protected com.liferay.portal.service.persistence.LayoutPersistence layoutPersistence;
2155    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutPrototypePersistence")
2156    protected com.liferay.portal.service.persistence.LayoutPrototypePersistence layoutPrototypePersistence;
2157    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPersistence")
2158    protected com.liferay.portal.service.persistence.LayoutSetPersistence layoutSetPersistence;
2159    @BeanReference(name = "com.liferay.portal.service.persistence.LayoutSetPrototypePersistence")
2160    protected com.liferay.portal.service.persistence.LayoutSetPrototypePersistence layoutSetPrototypePersistence;
2161    @BeanReference(name = "com.liferay.portal.service.persistence.ListTypePersistence")
2162    protected com.liferay.portal.service.persistence.ListTypePersistence listTypePersistence;
2163    @BeanReference(name = "com.liferay.portal.service.persistence.LockPersistence")
2164    protected com.liferay.portal.service.persistence.LockPersistence lockPersistence;
2165    @BeanReference(name = "com.liferay.portal.service.persistence.MembershipRequestPersistence")
2166    protected com.liferay.portal.service.persistence.MembershipRequestPersistence membershipRequestPersistence;
2167    @BeanReference(name = "com.liferay.portal.service.persistence.OrganizationPersistence")
2168    protected com.liferay.portal.service.persistence.OrganizationPersistence organizationPersistence;
2169    @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupPermissionPersistence")
2170    protected com.liferay.portal.service.persistence.OrgGroupPermissionPersistence orgGroupPermissionPersistence;
2171    @BeanReference(name = "com.liferay.portal.service.persistence.OrgGroupRolePersistence")
2172    protected com.liferay.portal.service.persistence.OrgGroupRolePersistence orgGroupRolePersistence;
2173    @BeanReference(name = "com.liferay.portal.service.persistence.OrgLaborPersistence")
2174    protected com.liferay.portal.service.persistence.OrgLaborPersistence orgLaborPersistence;
2175    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyPersistence")
2176    protected com.liferay.portal.service.persistence.PasswordPolicyPersistence passwordPolicyPersistence;
2177    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordPolicyRelPersistence")
2178    protected com.liferay.portal.service.persistence.PasswordPolicyRelPersistence passwordPolicyRelPersistence;
2179    @BeanReference(name = "com.liferay.portal.service.persistence.PasswordTrackerPersistence")
2180    protected com.liferay.portal.service.persistence.PasswordTrackerPersistence passwordTrackerPersistence;
2181    @BeanReference(name = "com.liferay.portal.service.persistence.PermissionPersistence")
2182    protected com.liferay.portal.service.persistence.PermissionPersistence permissionPersistence;
2183    @BeanReference(name = "com.liferay.portal.service.persistence.PhonePersistence")
2184    protected com.liferay.portal.service.persistence.PhonePersistence phonePersistence;
2185    @BeanReference(name = "com.liferay.portal.service.persistence.PluginSettingPersistence")
2186    protected com.liferay.portal.service.persistence.PluginSettingPersistence pluginSettingPersistence;
2187    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPersistence")
2188    protected com.liferay.portal.service.persistence.PortletPersistence portletPersistence;
2189    @BeanReference(name = "com.liferay.portal.service.persistence.PortletItemPersistence")
2190    protected com.liferay.portal.service.persistence.PortletItemPersistence portletItemPersistence;
2191    @BeanReference(name = "com.liferay.portal.service.persistence.PortletPreferencesPersistence")
2192    protected com.liferay.portal.service.persistence.PortletPreferencesPersistence portletPreferencesPersistence;
2193    @BeanReference(name = "com.liferay.portal.service.persistence.RegionPersistence")
2194    protected com.liferay.portal.service.persistence.RegionPersistence regionPersistence;
2195    @BeanReference(name = "com.liferay.portal.service.persistence.ReleasePersistence")
2196    protected com.liferay.portal.service.persistence.ReleasePersistence releasePersistence;
2197    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence")
2198    protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
2199    @BeanReference(name = "com.liferay.portal.service.persistence.ResourceActionPersistence")
2200    protected com.liferay.portal.service.persistence.ResourceActionPersistence resourceActionPersistence;
2201    @BeanReference(name = "com.liferay.portal.service.persistence.ResourceCodePersistence")
2202    protected com.liferay.portal.service.persistence.ResourceCodePersistence resourceCodePersistence;
2203    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePermissionPersistence")
2204    protected com.liferay.portal.service.persistence.ResourcePermissionPersistence resourcePermissionPersistence;
2205    @BeanReference(name = "com.liferay.portal.service.persistence.RolePersistence")
2206    protected com.liferay.portal.service.persistence.RolePersistence rolePersistence;
2207    @BeanReference(name = "com.liferay.portal.service.persistence.ServiceComponentPersistence")
2208    protected com.liferay.portal.service.persistence.ServiceComponentPersistence serviceComponentPersistence;
2209    @BeanReference(name = "com.liferay.portal.service.persistence.ShardPersistence")
2210    protected com.liferay.portal.service.persistence.ShardPersistence shardPersistence;
2211    @BeanReference(name = "com.liferay.portal.service.persistence.SubscriptionPersistence")
2212    protected com.liferay.portal.service.persistence.SubscriptionPersistence subscriptionPersistence;
2213    @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence")
2214    protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
2215    @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupPersistence")
2216    protected com.liferay.portal.service.persistence.UserGroupPersistence userGroupPersistence;
2217    @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupGroupRolePersistence")
2218    protected com.liferay.portal.service.persistence.UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2219    @BeanReference(name = "com.liferay.portal.service.persistence.UserGroupRolePersistence")
2220    protected com.liferay.portal.service.persistence.UserGroupRolePersistence userGroupRolePersistence;
2221    @BeanReference(name = "com.liferay.portal.service.persistence.UserIdMapperPersistence")
2222    protected com.liferay.portal.service.persistence.UserIdMapperPersistence userIdMapperPersistence;
2223    @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPersistence")
2224    protected com.liferay.portal.service.persistence.UserTrackerPersistence userTrackerPersistence;
2225    @BeanReference(name = "com.liferay.portal.service.persistence.UserTrackerPathPersistence")
2226    protected com.liferay.portal.service.persistence.UserTrackerPathPersistence userTrackerPathPersistence;
2227    @BeanReference(name = "com.liferay.portal.service.persistence.WebDAVPropsPersistence")
2228    protected com.liferay.portal.service.persistence.WebDAVPropsPersistence webDAVPropsPersistence;
2229    @BeanReference(name = "com.liferay.portal.service.persistence.WebsitePersistence")
2230    protected com.liferay.portal.service.persistence.WebsitePersistence websitePersistence;
2231    @BeanReference(name = "com.liferay.portal.service.persistence.WorkflowDefinitionLinkPersistence")
2232    protected com.liferay.portal.service.persistence.WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2233    @BeanReference(name = "com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence")
2234    protected com.liferay.portal.service.persistence.WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2235    private static final String _SQL_SELECT_PHONE = "SELECT phone FROM Phone phone";
2236    private static final String _SQL_SELECT_PHONE_WHERE = "SELECT phone FROM Phone phone WHERE ";
2237    private static final String _SQL_COUNT_PHONE = "SELECT COUNT(phone) FROM Phone phone";
2238    private static final String _SQL_COUNT_PHONE_WHERE = "SELECT COUNT(phone) FROM Phone phone WHERE ";
2239    private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "phone.companyId = ?";
2240    private static final String _FINDER_COLUMN_USERID_USERID_2 = "phone.userId = ?";
2241    private static final String _FINDER_COLUMN_C_C_COMPANYID_2 = "phone.companyId = ? AND ";
2242    private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "phone.classNameId = ?";
2243    private static final String _FINDER_COLUMN_C_C_C_COMPANYID_2 = "phone.companyId = ? AND ";
2244    private static final String _FINDER_COLUMN_C_C_C_CLASSNAMEID_2 = "phone.classNameId = ? AND ";
2245    private static final String _FINDER_COLUMN_C_C_C_CLASSPK_2 = "phone.classPK = ?";
2246    private static final String _FINDER_COLUMN_C_C_C_P_COMPANYID_2 = "phone.companyId = ? AND ";
2247    private static final String _FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2 = "phone.classNameId = ? AND ";
2248    private static final String _FINDER_COLUMN_C_C_C_P_CLASSPK_2 = "phone.classPK = ? AND ";
2249    private static final String _FINDER_COLUMN_C_C_C_P_PRIMARY_2 = "phone.primary = ?";
2250    private static final String _ORDER_BY_ENTITY_ALIAS = "phone.";
2251    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Phone exists with the primary key ";
2252    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Phone exists with the key {";
2253    private static Log _log = LogFactoryUtil.getLog(PhonePersistenceImpl.class);
2254}