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