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