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