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