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