001
014
015 package com.liferay.portal.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.NoSuchPhoneException;
019 import com.liferay.portal.kernel.bean.BeanReference;
020 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023 import com.liferay.portal.kernel.dao.orm.FinderPath;
024 import com.liferay.portal.kernel.dao.orm.Query;
025 import com.liferay.portal.kernel.dao.orm.QueryPos;
026 import com.liferay.portal.kernel.dao.orm.QueryUtil;
027 import com.liferay.portal.kernel.dao.orm.Session;
028 import com.liferay.portal.kernel.exception.SystemException;
029 import com.liferay.portal.kernel.log.Log;
030 import com.liferay.portal.kernel.log.LogFactoryUtil;
031 import com.liferay.portal.kernel.util.GetterUtil;
032 import com.liferay.portal.kernel.util.InstanceFactory;
033 import com.liferay.portal.kernel.util.OrderByComparator;
034 import com.liferay.portal.kernel.util.StringBundler;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.model.CacheModel;
038 import com.liferay.portal.model.ModelListener;
039 import com.liferay.portal.model.Phone;
040 import com.liferay.portal.model.impl.PhoneImpl;
041 import com.liferay.portal.model.impl.PhoneModelImpl;
042 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
043
044 import java.io.Serializable;
045
046 import java.util.ArrayList;
047 import java.util.Collections;
048 import java.util.List;
049
050
062 public class PhonePersistenceImpl extends BasePersistenceImpl<Phone>
063 implements PhonePersistence {
064
069 public static final String FINDER_CLASS_NAME_ENTITY = PhoneImpl.class.getName();
070 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
071 ".List1";
072 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
073 ".List2";
074 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID =
075 new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
076 PhoneModelImpl.FINDER_CACHE_ENABLED, PhoneImpl.class,
077 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByCompanyId",
078 new String[] {
079 Long.class.getName(),
080
081 "java.lang.Integer", "java.lang.Integer",
082 "com.liferay.portal.kernel.util.OrderByComparator"
083 });
084 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID =
085 new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
086 PhoneModelImpl.FINDER_CACHE_ENABLED, PhoneImpl.class,
087 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
088 new String[] { Long.class.getName() },
089 PhoneModelImpl.COMPANYID_COLUMN_BITMASK);
090 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
091 PhoneModelImpl.FINDER_CACHE_ENABLED, Long.class,
092 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId",
093 new String[] { Long.class.getName() });
094 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
095 PhoneModelImpl.FINDER_CACHE_ENABLED, PhoneImpl.class,
096 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUserId",
097 new String[] {
098 Long.class.getName(),
099
100 "java.lang.Integer", "java.lang.Integer",
101 "com.liferay.portal.kernel.util.OrderByComparator"
102 });
103 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID =
104 new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
105 PhoneModelImpl.FINDER_CACHE_ENABLED, PhoneImpl.class,
106 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUserId",
107 new String[] { Long.class.getName() },
108 PhoneModelImpl.USERID_COLUMN_BITMASK);
109 public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
110 PhoneModelImpl.FINDER_CACHE_ENABLED, Long.class,
111 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUserId",
112 new String[] { Long.class.getName() });
113 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
114 PhoneModelImpl.FINDER_CACHE_ENABLED, PhoneImpl.class,
115 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_C",
116 new String[] {
117 Long.class.getName(), Long.class.getName(),
118
119 "java.lang.Integer", "java.lang.Integer",
120 "com.liferay.portal.kernel.util.OrderByComparator"
121 });
122 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
123 PhoneModelImpl.FINDER_CACHE_ENABLED, PhoneImpl.class,
124 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_C",
125 new String[] { Long.class.getName(), Long.class.getName() },
126 PhoneModelImpl.COMPANYID_COLUMN_BITMASK |
127 PhoneModelImpl.CLASSNAMEID_COLUMN_BITMASK);
128 public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
129 PhoneModelImpl.FINDER_CACHE_ENABLED, Long.class,
130 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C",
131 new String[] { Long.class.getName(), Long.class.getName() });
132 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_C = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
133 PhoneModelImpl.FINDER_CACHE_ENABLED, PhoneImpl.class,
134 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_C_C",
135 new String[] {
136 Long.class.getName(), Long.class.getName(), Long.class.getName(),
137
138 "java.lang.Integer", "java.lang.Integer",
139 "com.liferay.portal.kernel.util.OrderByComparator"
140 });
141 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
142 PhoneModelImpl.FINDER_CACHE_ENABLED, PhoneImpl.class,
143 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_C_C",
144 new String[] {
145 Long.class.getName(), Long.class.getName(), Long.class.getName()
146 },
147 PhoneModelImpl.COMPANYID_COLUMN_BITMASK |
148 PhoneModelImpl.CLASSNAMEID_COLUMN_BITMASK |
149 PhoneModelImpl.CLASSPK_COLUMN_BITMASK);
150 public static final FinderPath FINDER_PATH_COUNT_BY_C_C_C = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
151 PhoneModelImpl.FINDER_CACHE_ENABLED, Long.class,
152 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C_C",
153 new String[] {
154 Long.class.getName(), Long.class.getName(), Long.class.getName()
155 });
156 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_C_P = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
157 PhoneModelImpl.FINDER_CACHE_ENABLED, PhoneImpl.class,
158 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_C_C_P",
159 new String[] {
160 Long.class.getName(), Long.class.getName(), Long.class.getName(),
161 Boolean.class.getName(),
162
163 "java.lang.Integer", "java.lang.Integer",
164 "com.liferay.portal.kernel.util.OrderByComparator"
165 });
166 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C_P =
167 new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
168 PhoneModelImpl.FINDER_CACHE_ENABLED, PhoneImpl.class,
169 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_C_C_P",
170 new String[] {
171 Long.class.getName(), Long.class.getName(), Long.class.getName(),
172 Boolean.class.getName()
173 },
174 PhoneModelImpl.COMPANYID_COLUMN_BITMASK |
175 PhoneModelImpl.CLASSNAMEID_COLUMN_BITMASK |
176 PhoneModelImpl.CLASSPK_COLUMN_BITMASK |
177 PhoneModelImpl.PRIMARY_COLUMN_BITMASK);
178 public static final FinderPath FINDER_PATH_COUNT_BY_C_C_C_P = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
179 PhoneModelImpl.FINDER_CACHE_ENABLED, Long.class,
180 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C_C_P",
181 new String[] {
182 Long.class.getName(), Long.class.getName(), Long.class.getName(),
183 Boolean.class.getName()
184 });
185 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
186 PhoneModelImpl.FINDER_CACHE_ENABLED, PhoneImpl.class,
187 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
188 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
189 PhoneModelImpl.FINDER_CACHE_ENABLED, PhoneImpl.class,
190 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
191 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PhoneModelImpl.ENTITY_CACHE_ENABLED,
192 PhoneModelImpl.FINDER_CACHE_ENABLED, Long.class,
193 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
194
195
200 public void cacheResult(Phone phone) {
201 EntityCacheUtil.putResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
202 PhoneImpl.class, phone.getPrimaryKey(), phone);
203
204 phone.resetOriginalValues();
205 }
206
207
212 public void cacheResult(List<Phone> phones) {
213 for (Phone phone : phones) {
214 if (EntityCacheUtil.getResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
215 PhoneImpl.class, phone.getPrimaryKey()) == null) {
216 cacheResult(phone);
217 }
218 else {
219 phone.resetOriginalValues();
220 }
221 }
222 }
223
224
231 @Override
232 public void clearCache() {
233 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
234 CacheRegistryUtil.clear(PhoneImpl.class.getName());
235 }
236
237 EntityCacheUtil.clearCache(PhoneImpl.class.getName());
238
239 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
240 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
241 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
242 }
243
244
251 @Override
252 public void clearCache(Phone phone) {
253 EntityCacheUtil.removeResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
254 PhoneImpl.class, phone.getPrimaryKey());
255
256 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
257 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
258 }
259
260 @Override
261 public void clearCache(List<Phone> phones) {
262 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
263 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
264
265 for (Phone phone : phones) {
266 EntityCacheUtil.removeResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
267 PhoneImpl.class, phone.getPrimaryKey());
268 }
269 }
270
271
277 public Phone create(long phoneId) {
278 Phone phone = new PhoneImpl();
279
280 phone.setNew(true);
281 phone.setPrimaryKey(phoneId);
282
283 return phone;
284 }
285
286
294 public Phone remove(long phoneId)
295 throws NoSuchPhoneException, SystemException {
296 return remove(Long.valueOf(phoneId));
297 }
298
299
307 @Override
308 public Phone remove(Serializable primaryKey)
309 throws NoSuchPhoneException, SystemException {
310 Session session = null;
311
312 try {
313 session = openSession();
314
315 Phone phone = (Phone)session.get(PhoneImpl.class, primaryKey);
316
317 if (phone == null) {
318 if (_log.isWarnEnabled()) {
319 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
320 }
321
322 throw new NoSuchPhoneException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
323 primaryKey);
324 }
325
326 return remove(phone);
327 }
328 catch (NoSuchPhoneException nsee) {
329 throw nsee;
330 }
331 catch (Exception e) {
332 throw processException(e);
333 }
334 finally {
335 closeSession(session);
336 }
337 }
338
339 @Override
340 protected Phone removeImpl(Phone phone) throws SystemException {
341 phone = toUnwrappedModel(phone);
342
343 Session session = null;
344
345 try {
346 session = openSession();
347
348 BatchSessionUtil.delete(session, phone);
349 }
350 catch (Exception e) {
351 throw processException(e);
352 }
353 finally {
354 closeSession(session);
355 }
356
357 clearCache(phone);
358
359 return phone;
360 }
361
362 @Override
363 public Phone updateImpl(com.liferay.portal.model.Phone phone, boolean merge)
364 throws SystemException {
365 phone = toUnwrappedModel(phone);
366
367 boolean isNew = phone.isNew();
368
369 PhoneModelImpl phoneModelImpl = (PhoneModelImpl)phone;
370
371 Session session = null;
372
373 try {
374 session = openSession();
375
376 BatchSessionUtil.update(session, phone, merge);
377
378 phone.setNew(false);
379 }
380 catch (Exception e) {
381 throw processException(e);
382 }
383 finally {
384 closeSession(session);
385 }
386
387 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
388
389 if (isNew || !PhoneModelImpl.COLUMN_BITMASK_ENABLED) {
390 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
391 }
392
393 else {
394 if ((phoneModelImpl.getColumnBitmask() &
395 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
396 Object[] args = new Object[] {
397 Long.valueOf(phoneModelImpl.getOriginalCompanyId())
398 };
399
400 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
401 args);
402 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
403 args);
404
405 args = new Object[] { Long.valueOf(phoneModelImpl.getCompanyId()) };
406
407 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
408 args);
409 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
410 args);
411 }
412
413 if ((phoneModelImpl.getColumnBitmask() &
414 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask()) != 0) {
415 Object[] args = new Object[] {
416 Long.valueOf(phoneModelImpl.getOriginalUserId())
417 };
418
419 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
420 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
421 args);
422
423 args = new Object[] { Long.valueOf(phoneModelImpl.getUserId()) };
424
425 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
426 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
427 args);
428 }
429
430 if ((phoneModelImpl.getColumnBitmask() &
431 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C.getColumnBitmask()) != 0) {
432 Object[] args = new Object[] {
433 Long.valueOf(phoneModelImpl.getOriginalCompanyId()),
434 Long.valueOf(phoneModelImpl.getOriginalClassNameId())
435 };
436
437 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
438 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C,
439 args);
440
441 args = new Object[] {
442 Long.valueOf(phoneModelImpl.getCompanyId()),
443 Long.valueOf(phoneModelImpl.getClassNameId())
444 };
445
446 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
447 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C,
448 args);
449 }
450
451 if ((phoneModelImpl.getColumnBitmask() &
452 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C.getColumnBitmask()) != 0) {
453 Object[] args = new Object[] {
454 Long.valueOf(phoneModelImpl.getOriginalCompanyId()),
455 Long.valueOf(phoneModelImpl.getOriginalClassNameId()),
456 Long.valueOf(phoneModelImpl.getOriginalClassPK())
457 };
458
459 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_C, args);
460 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C,
461 args);
462
463 args = new Object[] {
464 Long.valueOf(phoneModelImpl.getCompanyId()),
465 Long.valueOf(phoneModelImpl.getClassNameId()),
466 Long.valueOf(phoneModelImpl.getClassPK())
467 };
468
469 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_C, args);
470 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C,
471 args);
472 }
473
474 if ((phoneModelImpl.getColumnBitmask() &
475 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C_P.getColumnBitmask()) != 0) {
476 Object[] args = new Object[] {
477 Long.valueOf(phoneModelImpl.getOriginalCompanyId()),
478 Long.valueOf(phoneModelImpl.getOriginalClassNameId()),
479 Long.valueOf(phoneModelImpl.getOriginalClassPK()),
480 Boolean.valueOf(phoneModelImpl.getOriginalPrimary())
481 };
482
483 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_C_P, args);
484 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C_P,
485 args);
486
487 args = new Object[] {
488 Long.valueOf(phoneModelImpl.getCompanyId()),
489 Long.valueOf(phoneModelImpl.getClassNameId()),
490 Long.valueOf(phoneModelImpl.getClassPK()),
491 Boolean.valueOf(phoneModelImpl.getPrimary())
492 };
493
494 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_C_P, args);
495 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C_P,
496 args);
497 }
498 }
499
500 EntityCacheUtil.putResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
501 PhoneImpl.class, phone.getPrimaryKey(), phone);
502
503 return phone;
504 }
505
506 protected Phone toUnwrappedModel(Phone phone) {
507 if (phone instanceof PhoneImpl) {
508 return phone;
509 }
510
511 PhoneImpl phoneImpl = new PhoneImpl();
512
513 phoneImpl.setNew(phone.isNew());
514 phoneImpl.setPrimaryKey(phone.getPrimaryKey());
515
516 phoneImpl.setPhoneId(phone.getPhoneId());
517 phoneImpl.setCompanyId(phone.getCompanyId());
518 phoneImpl.setUserId(phone.getUserId());
519 phoneImpl.setUserName(phone.getUserName());
520 phoneImpl.setCreateDate(phone.getCreateDate());
521 phoneImpl.setModifiedDate(phone.getModifiedDate());
522 phoneImpl.setClassNameId(phone.getClassNameId());
523 phoneImpl.setClassPK(phone.getClassPK());
524 phoneImpl.setNumber(phone.getNumber());
525 phoneImpl.setExtension(phone.getExtension());
526 phoneImpl.setTypeId(phone.getTypeId());
527 phoneImpl.setPrimary(phone.isPrimary());
528
529 return phoneImpl;
530 }
531
532
540 @Override
541 public Phone findByPrimaryKey(Serializable primaryKey)
542 throws NoSuchModelException, SystemException {
543 return findByPrimaryKey(((Long)primaryKey).longValue());
544 }
545
546
554 public Phone findByPrimaryKey(long phoneId)
555 throws NoSuchPhoneException, SystemException {
556 Phone phone = fetchByPrimaryKey(phoneId);
557
558 if (phone == null) {
559 if (_log.isWarnEnabled()) {
560 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + phoneId);
561 }
562
563 throw new NoSuchPhoneException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
564 phoneId);
565 }
566
567 return phone;
568 }
569
570
577 @Override
578 public Phone fetchByPrimaryKey(Serializable primaryKey)
579 throws SystemException {
580 return fetchByPrimaryKey(((Long)primaryKey).longValue());
581 }
582
583
590 public Phone fetchByPrimaryKey(long phoneId) throws SystemException {
591 Phone phone = (Phone)EntityCacheUtil.getResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
592 PhoneImpl.class, phoneId);
593
594 if (phone == _nullPhone) {
595 return null;
596 }
597
598 if (phone == null) {
599 Session session = null;
600
601 boolean hasException = false;
602
603 try {
604 session = openSession();
605
606 phone = (Phone)session.get(PhoneImpl.class,
607 Long.valueOf(phoneId));
608 }
609 catch (Exception e) {
610 hasException = true;
611
612 throw processException(e);
613 }
614 finally {
615 if (phone != null) {
616 cacheResult(phone);
617 }
618 else if (!hasException) {
619 EntityCacheUtil.putResult(PhoneModelImpl.ENTITY_CACHE_ENABLED,
620 PhoneImpl.class, phoneId, _nullPhone);
621 }
622
623 closeSession(session);
624 }
625 }
626
627 return phone;
628 }
629
630
637 public List<Phone> findByCompanyId(long companyId)
638 throws SystemException {
639 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
640 null);
641 }
642
643
656 public List<Phone> findByCompanyId(long companyId, int start, int end)
657 throws SystemException {
658 return findByCompanyId(companyId, start, end, null);
659 }
660
661
675 public List<Phone> findByCompanyId(long companyId, int start, int end,
676 OrderByComparator orderByComparator) throws SystemException {
677 FinderPath finderPath = null;
678 Object[] finderArgs = null;
679
680 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
681 (orderByComparator == null)) {
682 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
683 finderArgs = new Object[] { companyId };
684 }
685 else {
686 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
687 finderArgs = new Object[] { companyId, start, end, orderByComparator };
688 }
689
690 List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(finderPath,
691 finderArgs, this);
692
693 if ((list != null) && !list.isEmpty()) {
694 for (Phone phone : list) {
695 if ((companyId != phone.getCompanyId())) {
696 list = null;
697
698 break;
699 }
700 }
701 }
702
703 if (list == null) {
704 StringBundler query = null;
705
706 if (orderByComparator != null) {
707 query = new StringBundler(3 +
708 (orderByComparator.getOrderByFields().length * 3));
709 }
710 else {
711 query = new StringBundler(3);
712 }
713
714 query.append(_SQL_SELECT_PHONE_WHERE);
715
716 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
717
718 if (orderByComparator != null) {
719 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
720 orderByComparator);
721 }
722
723 else {
724 query.append(PhoneModelImpl.ORDER_BY_JPQL);
725 }
726
727 String sql = query.toString();
728
729 Session session = null;
730
731 try {
732 session = openSession();
733
734 Query q = session.createQuery(sql);
735
736 QueryPos qPos = QueryPos.getInstance(q);
737
738 qPos.add(companyId);
739
740 list = (List<Phone>)QueryUtil.list(q, getDialect(), start, end);
741 }
742 catch (Exception e) {
743 throw processException(e);
744 }
745 finally {
746 if (list == null) {
747 FinderCacheUtil.removeResult(finderPath, finderArgs);
748 }
749 else {
750 cacheResult(list);
751
752 FinderCacheUtil.putResult(finderPath, finderArgs, list);
753 }
754
755 closeSession(session);
756 }
757 }
758
759 return list;
760 }
761
762
771 public Phone findByCompanyId_First(long companyId,
772 OrderByComparator orderByComparator)
773 throws NoSuchPhoneException, SystemException {
774 Phone phone = fetchByCompanyId_First(companyId, orderByComparator);
775
776 if (phone != null) {
777 return phone;
778 }
779
780 StringBundler msg = new StringBundler(4);
781
782 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
783
784 msg.append("companyId=");
785 msg.append(companyId);
786
787 msg.append(StringPool.CLOSE_CURLY_BRACE);
788
789 throw new NoSuchPhoneException(msg.toString());
790 }
791
792
800 public Phone fetchByCompanyId_First(long companyId,
801 OrderByComparator orderByComparator) throws SystemException {
802 List<Phone> list = findByCompanyId(companyId, 0, 1, orderByComparator);
803
804 if (!list.isEmpty()) {
805 return list.get(0);
806 }
807
808 return null;
809 }
810
811
820 public Phone findByCompanyId_Last(long companyId,
821 OrderByComparator orderByComparator)
822 throws NoSuchPhoneException, SystemException {
823 Phone phone = fetchByCompanyId_Last(companyId, orderByComparator);
824
825 if (phone != null) {
826 return phone;
827 }
828
829 StringBundler msg = new StringBundler(4);
830
831 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
832
833 msg.append("companyId=");
834 msg.append(companyId);
835
836 msg.append(StringPool.CLOSE_CURLY_BRACE);
837
838 throw new NoSuchPhoneException(msg.toString());
839 }
840
841
849 public Phone fetchByCompanyId_Last(long companyId,
850 OrderByComparator orderByComparator) throws SystemException {
851 int count = countByCompanyId(companyId);
852
853 List<Phone> list = findByCompanyId(companyId, count - 1, count,
854 orderByComparator);
855
856 if (!list.isEmpty()) {
857 return list.get(0);
858 }
859
860 return null;
861 }
862
863
873 public Phone[] findByCompanyId_PrevAndNext(long phoneId, long companyId,
874 OrderByComparator orderByComparator)
875 throws NoSuchPhoneException, SystemException {
876 Phone phone = findByPrimaryKey(phoneId);
877
878 Session session = null;
879
880 try {
881 session = openSession();
882
883 Phone[] array = new PhoneImpl[3];
884
885 array[0] = getByCompanyId_PrevAndNext(session, phone, companyId,
886 orderByComparator, true);
887
888 array[1] = phone;
889
890 array[2] = getByCompanyId_PrevAndNext(session, phone, companyId,
891 orderByComparator, false);
892
893 return array;
894 }
895 catch (Exception e) {
896 throw processException(e);
897 }
898 finally {
899 closeSession(session);
900 }
901 }
902
903 protected Phone getByCompanyId_PrevAndNext(Session session, Phone phone,
904 long companyId, OrderByComparator orderByComparator, boolean previous) {
905 StringBundler query = null;
906
907 if (orderByComparator != null) {
908 query = new StringBundler(6 +
909 (orderByComparator.getOrderByFields().length * 6));
910 }
911 else {
912 query = new StringBundler(3);
913 }
914
915 query.append(_SQL_SELECT_PHONE_WHERE);
916
917 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
918
919 if (orderByComparator != null) {
920 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
921
922 if (orderByConditionFields.length > 0) {
923 query.append(WHERE_AND);
924 }
925
926 for (int i = 0; i < orderByConditionFields.length; i++) {
927 query.append(_ORDER_BY_ENTITY_ALIAS);
928 query.append(orderByConditionFields[i]);
929
930 if ((i + 1) < orderByConditionFields.length) {
931 if (orderByComparator.isAscending() ^ previous) {
932 query.append(WHERE_GREATER_THAN_HAS_NEXT);
933 }
934 else {
935 query.append(WHERE_LESSER_THAN_HAS_NEXT);
936 }
937 }
938 else {
939 if (orderByComparator.isAscending() ^ previous) {
940 query.append(WHERE_GREATER_THAN);
941 }
942 else {
943 query.append(WHERE_LESSER_THAN);
944 }
945 }
946 }
947
948 query.append(ORDER_BY_CLAUSE);
949
950 String[] orderByFields = orderByComparator.getOrderByFields();
951
952 for (int i = 0; i < orderByFields.length; i++) {
953 query.append(_ORDER_BY_ENTITY_ALIAS);
954 query.append(orderByFields[i]);
955
956 if ((i + 1) < orderByFields.length) {
957 if (orderByComparator.isAscending() ^ previous) {
958 query.append(ORDER_BY_ASC_HAS_NEXT);
959 }
960 else {
961 query.append(ORDER_BY_DESC_HAS_NEXT);
962 }
963 }
964 else {
965 if (orderByComparator.isAscending() ^ previous) {
966 query.append(ORDER_BY_ASC);
967 }
968 else {
969 query.append(ORDER_BY_DESC);
970 }
971 }
972 }
973 }
974
975 else {
976 query.append(PhoneModelImpl.ORDER_BY_JPQL);
977 }
978
979 String sql = query.toString();
980
981 Query q = session.createQuery(sql);
982
983 q.setFirstResult(0);
984 q.setMaxResults(2);
985
986 QueryPos qPos = QueryPos.getInstance(q);
987
988 qPos.add(companyId);
989
990 if (orderByComparator != null) {
991 Object[] values = orderByComparator.getOrderByConditionValues(phone);
992
993 for (Object value : values) {
994 qPos.add(value);
995 }
996 }
997
998 List<Phone> list = q.list();
999
1000 if (list.size() == 2) {
1001 return list.get(1);
1002 }
1003 else {
1004 return null;
1005 }
1006 }
1007
1008
1015 public List<Phone> findByUserId(long userId) throws SystemException {
1016 return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1017 }
1018
1019
1032 public List<Phone> findByUserId(long userId, int start, int end)
1033 throws SystemException {
1034 return findByUserId(userId, start, end, null);
1035 }
1036
1037
1051 public List<Phone> findByUserId(long userId, int start, int end,
1052 OrderByComparator orderByComparator) throws SystemException {
1053 FinderPath finderPath = null;
1054 Object[] finderArgs = null;
1055
1056 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1057 (orderByComparator == null)) {
1058 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID;
1059 finderArgs = new Object[] { userId };
1060 }
1061 else {
1062 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID;
1063 finderArgs = new Object[] { userId, start, end, orderByComparator };
1064 }
1065
1066 List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(finderPath,
1067 finderArgs, this);
1068
1069 if ((list != null) && !list.isEmpty()) {
1070 for (Phone phone : list) {
1071 if ((userId != phone.getUserId())) {
1072 list = null;
1073
1074 break;
1075 }
1076 }
1077 }
1078
1079 if (list == null) {
1080 StringBundler query = null;
1081
1082 if (orderByComparator != null) {
1083 query = new StringBundler(3 +
1084 (orderByComparator.getOrderByFields().length * 3));
1085 }
1086 else {
1087 query = new StringBundler(3);
1088 }
1089
1090 query.append(_SQL_SELECT_PHONE_WHERE);
1091
1092 query.append(_FINDER_COLUMN_USERID_USERID_2);
1093
1094 if (orderByComparator != null) {
1095 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1096 orderByComparator);
1097 }
1098
1099 else {
1100 query.append(PhoneModelImpl.ORDER_BY_JPQL);
1101 }
1102
1103 String sql = query.toString();
1104
1105 Session session = null;
1106
1107 try {
1108 session = openSession();
1109
1110 Query q = session.createQuery(sql);
1111
1112 QueryPos qPos = QueryPos.getInstance(q);
1113
1114 qPos.add(userId);
1115
1116 list = (List<Phone>)QueryUtil.list(q, getDialect(), start, end);
1117 }
1118 catch (Exception e) {
1119 throw processException(e);
1120 }
1121 finally {
1122 if (list == null) {
1123 FinderCacheUtil.removeResult(finderPath, finderArgs);
1124 }
1125 else {
1126 cacheResult(list);
1127
1128 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1129 }
1130
1131 closeSession(session);
1132 }
1133 }
1134
1135 return list;
1136 }
1137
1138
1147 public Phone findByUserId_First(long userId,
1148 OrderByComparator orderByComparator)
1149 throws NoSuchPhoneException, SystemException {
1150 Phone phone = fetchByUserId_First(userId, orderByComparator);
1151
1152 if (phone != null) {
1153 return phone;
1154 }
1155
1156 StringBundler msg = new StringBundler(4);
1157
1158 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1159
1160 msg.append("userId=");
1161 msg.append(userId);
1162
1163 msg.append(StringPool.CLOSE_CURLY_BRACE);
1164
1165 throw new NoSuchPhoneException(msg.toString());
1166 }
1167
1168
1176 public Phone fetchByUserId_First(long userId,
1177 OrderByComparator orderByComparator) throws SystemException {
1178 List<Phone> list = findByUserId(userId, 0, 1, orderByComparator);
1179
1180 if (!list.isEmpty()) {
1181 return list.get(0);
1182 }
1183
1184 return null;
1185 }
1186
1187
1196 public Phone findByUserId_Last(long userId,
1197 OrderByComparator orderByComparator)
1198 throws NoSuchPhoneException, SystemException {
1199 Phone phone = fetchByUserId_Last(userId, orderByComparator);
1200
1201 if (phone != null) {
1202 return phone;
1203 }
1204
1205 StringBundler msg = new StringBundler(4);
1206
1207 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1208
1209 msg.append("userId=");
1210 msg.append(userId);
1211
1212 msg.append(StringPool.CLOSE_CURLY_BRACE);
1213
1214 throw new NoSuchPhoneException(msg.toString());
1215 }
1216
1217
1225 public Phone fetchByUserId_Last(long userId,
1226 OrderByComparator orderByComparator) throws SystemException {
1227 int count = countByUserId(userId);
1228
1229 List<Phone> list = findByUserId(userId, count - 1, count,
1230 orderByComparator);
1231
1232 if (!list.isEmpty()) {
1233 return list.get(0);
1234 }
1235
1236 return null;
1237 }
1238
1239
1249 public Phone[] findByUserId_PrevAndNext(long phoneId, long userId,
1250 OrderByComparator orderByComparator)
1251 throws NoSuchPhoneException, SystemException {
1252 Phone phone = findByPrimaryKey(phoneId);
1253
1254 Session session = null;
1255
1256 try {
1257 session = openSession();
1258
1259 Phone[] array = new PhoneImpl[3];
1260
1261 array[0] = getByUserId_PrevAndNext(session, phone, userId,
1262 orderByComparator, true);
1263
1264 array[1] = phone;
1265
1266 array[2] = getByUserId_PrevAndNext(session, phone, userId,
1267 orderByComparator, false);
1268
1269 return array;
1270 }
1271 catch (Exception e) {
1272 throw processException(e);
1273 }
1274 finally {
1275 closeSession(session);
1276 }
1277 }
1278
1279 protected Phone getByUserId_PrevAndNext(Session session, Phone phone,
1280 long userId, OrderByComparator orderByComparator, boolean previous) {
1281 StringBundler query = null;
1282
1283 if (orderByComparator != null) {
1284 query = new StringBundler(6 +
1285 (orderByComparator.getOrderByFields().length * 6));
1286 }
1287 else {
1288 query = new StringBundler(3);
1289 }
1290
1291 query.append(_SQL_SELECT_PHONE_WHERE);
1292
1293 query.append(_FINDER_COLUMN_USERID_USERID_2);
1294
1295 if (orderByComparator != null) {
1296 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1297
1298 if (orderByConditionFields.length > 0) {
1299 query.append(WHERE_AND);
1300 }
1301
1302 for (int i = 0; i < orderByConditionFields.length; i++) {
1303 query.append(_ORDER_BY_ENTITY_ALIAS);
1304 query.append(orderByConditionFields[i]);
1305
1306 if ((i + 1) < orderByConditionFields.length) {
1307 if (orderByComparator.isAscending() ^ previous) {
1308 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1309 }
1310 else {
1311 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1312 }
1313 }
1314 else {
1315 if (orderByComparator.isAscending() ^ previous) {
1316 query.append(WHERE_GREATER_THAN);
1317 }
1318 else {
1319 query.append(WHERE_LESSER_THAN);
1320 }
1321 }
1322 }
1323
1324 query.append(ORDER_BY_CLAUSE);
1325
1326 String[] orderByFields = orderByComparator.getOrderByFields();
1327
1328 for (int i = 0; i < orderByFields.length; i++) {
1329 query.append(_ORDER_BY_ENTITY_ALIAS);
1330 query.append(orderByFields[i]);
1331
1332 if ((i + 1) < orderByFields.length) {
1333 if (orderByComparator.isAscending() ^ previous) {
1334 query.append(ORDER_BY_ASC_HAS_NEXT);
1335 }
1336 else {
1337 query.append(ORDER_BY_DESC_HAS_NEXT);
1338 }
1339 }
1340 else {
1341 if (orderByComparator.isAscending() ^ previous) {
1342 query.append(ORDER_BY_ASC);
1343 }
1344 else {
1345 query.append(ORDER_BY_DESC);
1346 }
1347 }
1348 }
1349 }
1350
1351 else {
1352 query.append(PhoneModelImpl.ORDER_BY_JPQL);
1353 }
1354
1355 String sql = query.toString();
1356
1357 Query q = session.createQuery(sql);
1358
1359 q.setFirstResult(0);
1360 q.setMaxResults(2);
1361
1362 QueryPos qPos = QueryPos.getInstance(q);
1363
1364 qPos.add(userId);
1365
1366 if (orderByComparator != null) {
1367 Object[] values = orderByComparator.getOrderByConditionValues(phone);
1368
1369 for (Object value : values) {
1370 qPos.add(value);
1371 }
1372 }
1373
1374 List<Phone> list = q.list();
1375
1376 if (list.size() == 2) {
1377 return list.get(1);
1378 }
1379 else {
1380 return null;
1381 }
1382 }
1383
1384
1392 public List<Phone> findByC_C(long companyId, long classNameId)
1393 throws SystemException {
1394 return findByC_C(companyId, classNameId, QueryUtil.ALL_POS,
1395 QueryUtil.ALL_POS, null);
1396 }
1397
1398
1412 public List<Phone> findByC_C(long companyId, long classNameId, int start,
1413 int end) throws SystemException {
1414 return findByC_C(companyId, classNameId, start, end, null);
1415 }
1416
1417
1432 public List<Phone> findByC_C(long companyId, long classNameId, int start,
1433 int end, OrderByComparator orderByComparator) throws SystemException {
1434 FinderPath finderPath = null;
1435 Object[] finderArgs = null;
1436
1437 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1438 (orderByComparator == null)) {
1439 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C;
1440 finderArgs = new Object[] { companyId, classNameId };
1441 }
1442 else {
1443 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C;
1444 finderArgs = new Object[] {
1445 companyId, classNameId,
1446
1447 start, end, orderByComparator
1448 };
1449 }
1450
1451 List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(finderPath,
1452 finderArgs, this);
1453
1454 if ((list != null) && !list.isEmpty()) {
1455 for (Phone phone : list) {
1456 if ((companyId != phone.getCompanyId()) ||
1457 (classNameId != phone.getClassNameId())) {
1458 list = null;
1459
1460 break;
1461 }
1462 }
1463 }
1464
1465 if (list == null) {
1466 StringBundler query = null;
1467
1468 if (orderByComparator != null) {
1469 query = new StringBundler(4 +
1470 (orderByComparator.getOrderByFields().length * 3));
1471 }
1472 else {
1473 query = new StringBundler(4);
1474 }
1475
1476 query.append(_SQL_SELECT_PHONE_WHERE);
1477
1478 query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
1479
1480 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1481
1482 if (orderByComparator != null) {
1483 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1484 orderByComparator);
1485 }
1486
1487 else {
1488 query.append(PhoneModelImpl.ORDER_BY_JPQL);
1489 }
1490
1491 String sql = query.toString();
1492
1493 Session session = null;
1494
1495 try {
1496 session = openSession();
1497
1498 Query q = session.createQuery(sql);
1499
1500 QueryPos qPos = QueryPos.getInstance(q);
1501
1502 qPos.add(companyId);
1503
1504 qPos.add(classNameId);
1505
1506 list = (List<Phone>)QueryUtil.list(q, getDialect(), start, end);
1507 }
1508 catch (Exception e) {
1509 throw processException(e);
1510 }
1511 finally {
1512 if (list == null) {
1513 FinderCacheUtil.removeResult(finderPath, finderArgs);
1514 }
1515 else {
1516 cacheResult(list);
1517
1518 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1519 }
1520
1521 closeSession(session);
1522 }
1523 }
1524
1525 return list;
1526 }
1527
1528
1538 public Phone findByC_C_First(long companyId, long classNameId,
1539 OrderByComparator orderByComparator)
1540 throws NoSuchPhoneException, SystemException {
1541 Phone phone = fetchByC_C_First(companyId, classNameId, orderByComparator);
1542
1543 if (phone != null) {
1544 return phone;
1545 }
1546
1547 StringBundler msg = new StringBundler(6);
1548
1549 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1550
1551 msg.append("companyId=");
1552 msg.append(companyId);
1553
1554 msg.append(", classNameId=");
1555 msg.append(classNameId);
1556
1557 msg.append(StringPool.CLOSE_CURLY_BRACE);
1558
1559 throw new NoSuchPhoneException(msg.toString());
1560 }
1561
1562
1571 public Phone fetchByC_C_First(long companyId, long classNameId,
1572 OrderByComparator orderByComparator) throws SystemException {
1573 List<Phone> list = findByC_C(companyId, classNameId, 0, 1,
1574 orderByComparator);
1575
1576 if (!list.isEmpty()) {
1577 return list.get(0);
1578 }
1579
1580 return null;
1581 }
1582
1583
1593 public Phone findByC_C_Last(long companyId, long classNameId,
1594 OrderByComparator orderByComparator)
1595 throws NoSuchPhoneException, SystemException {
1596 Phone phone = fetchByC_C_Last(companyId, classNameId, orderByComparator);
1597
1598 if (phone != null) {
1599 return phone;
1600 }
1601
1602 StringBundler msg = new StringBundler(6);
1603
1604 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1605
1606 msg.append("companyId=");
1607 msg.append(companyId);
1608
1609 msg.append(", classNameId=");
1610 msg.append(classNameId);
1611
1612 msg.append(StringPool.CLOSE_CURLY_BRACE);
1613
1614 throw new NoSuchPhoneException(msg.toString());
1615 }
1616
1617
1626 public Phone fetchByC_C_Last(long companyId, long classNameId,
1627 OrderByComparator orderByComparator) throws SystemException {
1628 int count = countByC_C(companyId, classNameId);
1629
1630 List<Phone> list = findByC_C(companyId, classNameId, count - 1, count,
1631 orderByComparator);
1632
1633 if (!list.isEmpty()) {
1634 return list.get(0);
1635 }
1636
1637 return null;
1638 }
1639
1640
1651 public Phone[] findByC_C_PrevAndNext(long phoneId, long companyId,
1652 long classNameId, OrderByComparator orderByComparator)
1653 throws NoSuchPhoneException, SystemException {
1654 Phone phone = findByPrimaryKey(phoneId);
1655
1656 Session session = null;
1657
1658 try {
1659 session = openSession();
1660
1661 Phone[] array = new PhoneImpl[3];
1662
1663 array[0] = getByC_C_PrevAndNext(session, phone, companyId,
1664 classNameId, orderByComparator, true);
1665
1666 array[1] = phone;
1667
1668 array[2] = getByC_C_PrevAndNext(session, phone, companyId,
1669 classNameId, orderByComparator, false);
1670
1671 return array;
1672 }
1673 catch (Exception e) {
1674 throw processException(e);
1675 }
1676 finally {
1677 closeSession(session);
1678 }
1679 }
1680
1681 protected Phone getByC_C_PrevAndNext(Session session, Phone phone,
1682 long companyId, long classNameId, OrderByComparator orderByComparator,
1683 boolean previous) {
1684 StringBundler query = null;
1685
1686 if (orderByComparator != null) {
1687 query = new StringBundler(6 +
1688 (orderByComparator.getOrderByFields().length * 6));
1689 }
1690 else {
1691 query = new StringBundler(3);
1692 }
1693
1694 query.append(_SQL_SELECT_PHONE_WHERE);
1695
1696 query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
1697
1698 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1699
1700 if (orderByComparator != null) {
1701 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1702
1703 if (orderByConditionFields.length > 0) {
1704 query.append(WHERE_AND);
1705 }
1706
1707 for (int i = 0; i < orderByConditionFields.length; i++) {
1708 query.append(_ORDER_BY_ENTITY_ALIAS);
1709 query.append(orderByConditionFields[i]);
1710
1711 if ((i + 1) < orderByConditionFields.length) {
1712 if (orderByComparator.isAscending() ^ previous) {
1713 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1714 }
1715 else {
1716 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1717 }
1718 }
1719 else {
1720 if (orderByComparator.isAscending() ^ previous) {
1721 query.append(WHERE_GREATER_THAN);
1722 }
1723 else {
1724 query.append(WHERE_LESSER_THAN);
1725 }
1726 }
1727 }
1728
1729 query.append(ORDER_BY_CLAUSE);
1730
1731 String[] orderByFields = orderByComparator.getOrderByFields();
1732
1733 for (int i = 0; i < orderByFields.length; i++) {
1734 query.append(_ORDER_BY_ENTITY_ALIAS);
1735 query.append(orderByFields[i]);
1736
1737 if ((i + 1) < orderByFields.length) {
1738 if (orderByComparator.isAscending() ^ previous) {
1739 query.append(ORDER_BY_ASC_HAS_NEXT);
1740 }
1741 else {
1742 query.append(ORDER_BY_DESC_HAS_NEXT);
1743 }
1744 }
1745 else {
1746 if (orderByComparator.isAscending() ^ previous) {
1747 query.append(ORDER_BY_ASC);
1748 }
1749 else {
1750 query.append(ORDER_BY_DESC);
1751 }
1752 }
1753 }
1754 }
1755
1756 else {
1757 query.append(PhoneModelImpl.ORDER_BY_JPQL);
1758 }
1759
1760 String sql = query.toString();
1761
1762 Query q = session.createQuery(sql);
1763
1764 q.setFirstResult(0);
1765 q.setMaxResults(2);
1766
1767 QueryPos qPos = QueryPos.getInstance(q);
1768
1769 qPos.add(companyId);
1770
1771 qPos.add(classNameId);
1772
1773 if (orderByComparator != null) {
1774 Object[] values = orderByComparator.getOrderByConditionValues(phone);
1775
1776 for (Object value : values) {
1777 qPos.add(value);
1778 }
1779 }
1780
1781 List<Phone> list = q.list();
1782
1783 if (list.size() == 2) {
1784 return list.get(1);
1785 }
1786 else {
1787 return null;
1788 }
1789 }
1790
1791
1800 public List<Phone> findByC_C_C(long companyId, long classNameId,
1801 long classPK) throws SystemException {
1802 return findByC_C_C(companyId, classNameId, classPK, QueryUtil.ALL_POS,
1803 QueryUtil.ALL_POS, null);
1804 }
1805
1806
1821 public List<Phone> findByC_C_C(long companyId, long classNameId,
1822 long classPK, int start, int end) throws SystemException {
1823 return findByC_C_C(companyId, classNameId, classPK, start, end, null);
1824 }
1825
1826
1842 public List<Phone> findByC_C_C(long companyId, long classNameId,
1843 long classPK, int start, int end, OrderByComparator orderByComparator)
1844 throws SystemException {
1845 FinderPath finderPath = null;
1846 Object[] finderArgs = null;
1847
1848 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1849 (orderByComparator == null)) {
1850 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C;
1851 finderArgs = new Object[] { companyId, classNameId, classPK };
1852 }
1853 else {
1854 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_C;
1855 finderArgs = new Object[] {
1856 companyId, classNameId, classPK,
1857
1858 start, end, orderByComparator
1859 };
1860 }
1861
1862 List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(finderPath,
1863 finderArgs, this);
1864
1865 if ((list != null) && !list.isEmpty()) {
1866 for (Phone phone : list) {
1867 if ((companyId != phone.getCompanyId()) ||
1868 (classNameId != phone.getClassNameId()) ||
1869 (classPK != phone.getClassPK())) {
1870 list = null;
1871
1872 break;
1873 }
1874 }
1875 }
1876
1877 if (list == null) {
1878 StringBundler query = null;
1879
1880 if (orderByComparator != null) {
1881 query = new StringBundler(5 +
1882 (orderByComparator.getOrderByFields().length * 3));
1883 }
1884 else {
1885 query = new StringBundler(5);
1886 }
1887
1888 query.append(_SQL_SELECT_PHONE_WHERE);
1889
1890 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
1891
1892 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
1893
1894 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
1895
1896 if (orderByComparator != null) {
1897 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1898 orderByComparator);
1899 }
1900
1901 else {
1902 query.append(PhoneModelImpl.ORDER_BY_JPQL);
1903 }
1904
1905 String sql = query.toString();
1906
1907 Session session = null;
1908
1909 try {
1910 session = openSession();
1911
1912 Query q = session.createQuery(sql);
1913
1914 QueryPos qPos = QueryPos.getInstance(q);
1915
1916 qPos.add(companyId);
1917
1918 qPos.add(classNameId);
1919
1920 qPos.add(classPK);
1921
1922 list = (List<Phone>)QueryUtil.list(q, getDialect(), start, end);
1923 }
1924 catch (Exception e) {
1925 throw processException(e);
1926 }
1927 finally {
1928 if (list == null) {
1929 FinderCacheUtil.removeResult(finderPath, finderArgs);
1930 }
1931 else {
1932 cacheResult(list);
1933
1934 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1935 }
1936
1937 closeSession(session);
1938 }
1939 }
1940
1941 return list;
1942 }
1943
1944
1955 public Phone findByC_C_C_First(long companyId, long classNameId,
1956 long classPK, OrderByComparator orderByComparator)
1957 throws NoSuchPhoneException, SystemException {
1958 Phone phone = fetchByC_C_C_First(companyId, classNameId, classPK,
1959 orderByComparator);
1960
1961 if (phone != null) {
1962 return phone;
1963 }
1964
1965 StringBundler msg = new StringBundler(8);
1966
1967 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1968
1969 msg.append("companyId=");
1970 msg.append(companyId);
1971
1972 msg.append(", classNameId=");
1973 msg.append(classNameId);
1974
1975 msg.append(", classPK=");
1976 msg.append(classPK);
1977
1978 msg.append(StringPool.CLOSE_CURLY_BRACE);
1979
1980 throw new NoSuchPhoneException(msg.toString());
1981 }
1982
1983
1993 public Phone fetchByC_C_C_First(long companyId, long classNameId,
1994 long classPK, OrderByComparator orderByComparator)
1995 throws SystemException {
1996 List<Phone> list = findByC_C_C(companyId, classNameId, classPK, 0, 1,
1997 orderByComparator);
1998
1999 if (!list.isEmpty()) {
2000 return list.get(0);
2001 }
2002
2003 return null;
2004 }
2005
2006
2017 public Phone findByC_C_C_Last(long companyId, long classNameId,
2018 long classPK, OrderByComparator orderByComparator)
2019 throws NoSuchPhoneException, SystemException {
2020 Phone phone = fetchByC_C_C_Last(companyId, classNameId, classPK,
2021 orderByComparator);
2022
2023 if (phone != null) {
2024 return phone;
2025 }
2026
2027 StringBundler msg = new StringBundler(8);
2028
2029 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2030
2031 msg.append("companyId=");
2032 msg.append(companyId);
2033
2034 msg.append(", classNameId=");
2035 msg.append(classNameId);
2036
2037 msg.append(", classPK=");
2038 msg.append(classPK);
2039
2040 msg.append(StringPool.CLOSE_CURLY_BRACE);
2041
2042 throw new NoSuchPhoneException(msg.toString());
2043 }
2044
2045
2055 public Phone fetchByC_C_C_Last(long companyId, long classNameId,
2056 long classPK, OrderByComparator orderByComparator)
2057 throws SystemException {
2058 int count = countByC_C_C(companyId, classNameId, classPK);
2059
2060 List<Phone> list = findByC_C_C(companyId, classNameId, classPK,
2061 count - 1, count, orderByComparator);
2062
2063 if (!list.isEmpty()) {
2064 return list.get(0);
2065 }
2066
2067 return null;
2068 }
2069
2070
2082 public Phone[] findByC_C_C_PrevAndNext(long phoneId, long companyId,
2083 long classNameId, long classPK, OrderByComparator orderByComparator)
2084 throws NoSuchPhoneException, SystemException {
2085 Phone phone = findByPrimaryKey(phoneId);
2086
2087 Session session = null;
2088
2089 try {
2090 session = openSession();
2091
2092 Phone[] array = new PhoneImpl[3];
2093
2094 array[0] = getByC_C_C_PrevAndNext(session, phone, companyId,
2095 classNameId, classPK, orderByComparator, true);
2096
2097 array[1] = phone;
2098
2099 array[2] = getByC_C_C_PrevAndNext(session, phone, companyId,
2100 classNameId, classPK, orderByComparator, false);
2101
2102 return array;
2103 }
2104 catch (Exception e) {
2105 throw processException(e);
2106 }
2107 finally {
2108 closeSession(session);
2109 }
2110 }
2111
2112 protected Phone getByC_C_C_PrevAndNext(Session session, Phone phone,
2113 long companyId, long classNameId, long classPK,
2114 OrderByComparator orderByComparator, boolean previous) {
2115 StringBundler query = null;
2116
2117 if (orderByComparator != null) {
2118 query = new StringBundler(6 +
2119 (orderByComparator.getOrderByFields().length * 6));
2120 }
2121 else {
2122 query = new StringBundler(3);
2123 }
2124
2125 query.append(_SQL_SELECT_PHONE_WHERE);
2126
2127 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
2128
2129 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
2130
2131 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
2132
2133 if (orderByComparator != null) {
2134 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2135
2136 if (orderByConditionFields.length > 0) {
2137 query.append(WHERE_AND);
2138 }
2139
2140 for (int i = 0; i < orderByConditionFields.length; i++) {
2141 query.append(_ORDER_BY_ENTITY_ALIAS);
2142 query.append(orderByConditionFields[i]);
2143
2144 if ((i + 1) < orderByConditionFields.length) {
2145 if (orderByComparator.isAscending() ^ previous) {
2146 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2147 }
2148 else {
2149 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2150 }
2151 }
2152 else {
2153 if (orderByComparator.isAscending() ^ previous) {
2154 query.append(WHERE_GREATER_THAN);
2155 }
2156 else {
2157 query.append(WHERE_LESSER_THAN);
2158 }
2159 }
2160 }
2161
2162 query.append(ORDER_BY_CLAUSE);
2163
2164 String[] orderByFields = orderByComparator.getOrderByFields();
2165
2166 for (int i = 0; i < orderByFields.length; i++) {
2167 query.append(_ORDER_BY_ENTITY_ALIAS);
2168 query.append(orderByFields[i]);
2169
2170 if ((i + 1) < orderByFields.length) {
2171 if (orderByComparator.isAscending() ^ previous) {
2172 query.append(ORDER_BY_ASC_HAS_NEXT);
2173 }
2174 else {
2175 query.append(ORDER_BY_DESC_HAS_NEXT);
2176 }
2177 }
2178 else {
2179 if (orderByComparator.isAscending() ^ previous) {
2180 query.append(ORDER_BY_ASC);
2181 }
2182 else {
2183 query.append(ORDER_BY_DESC);
2184 }
2185 }
2186 }
2187 }
2188
2189 else {
2190 query.append(PhoneModelImpl.ORDER_BY_JPQL);
2191 }
2192
2193 String sql = query.toString();
2194
2195 Query q = session.createQuery(sql);
2196
2197 q.setFirstResult(0);
2198 q.setMaxResults(2);
2199
2200 QueryPos qPos = QueryPos.getInstance(q);
2201
2202 qPos.add(companyId);
2203
2204 qPos.add(classNameId);
2205
2206 qPos.add(classPK);
2207
2208 if (orderByComparator != null) {
2209 Object[] values = orderByComparator.getOrderByConditionValues(phone);
2210
2211 for (Object value : values) {
2212 qPos.add(value);
2213 }
2214 }
2215
2216 List<Phone> list = q.list();
2217
2218 if (list.size() == 2) {
2219 return list.get(1);
2220 }
2221 else {
2222 return null;
2223 }
2224 }
2225
2226
2236 public List<Phone> findByC_C_C_P(long companyId, long classNameId,
2237 long classPK, boolean primary) throws SystemException {
2238 return findByC_C_C_P(companyId, classNameId, classPK, primary,
2239 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2240 }
2241
2242
2258 public List<Phone> findByC_C_C_P(long companyId, long classNameId,
2259 long classPK, boolean primary, int start, int end)
2260 throws SystemException {
2261 return findByC_C_C_P(companyId, classNameId, classPK, primary, start,
2262 end, null);
2263 }
2264
2265
2282 public List<Phone> findByC_C_C_P(long companyId, long classNameId,
2283 long classPK, boolean primary, int start, int end,
2284 OrderByComparator orderByComparator) throws SystemException {
2285 FinderPath finderPath = null;
2286 Object[] finderArgs = null;
2287
2288 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2289 (orderByComparator == null)) {
2290 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_C_P;
2291 finderArgs = new Object[] { companyId, classNameId, classPK, primary };
2292 }
2293 else {
2294 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_C_P;
2295 finderArgs = new Object[] {
2296 companyId, classNameId, classPK, primary,
2297
2298 start, end, orderByComparator
2299 };
2300 }
2301
2302 List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(finderPath,
2303 finderArgs, this);
2304
2305 if ((list != null) && !list.isEmpty()) {
2306 for (Phone phone : list) {
2307 if ((companyId != phone.getCompanyId()) ||
2308 (classNameId != phone.getClassNameId()) ||
2309 (classPK != phone.getClassPK()) ||
2310 (primary != phone.getPrimary())) {
2311 list = null;
2312
2313 break;
2314 }
2315 }
2316 }
2317
2318 if (list == null) {
2319 StringBundler query = null;
2320
2321 if (orderByComparator != null) {
2322 query = new StringBundler(6 +
2323 (orderByComparator.getOrderByFields().length * 3));
2324 }
2325 else {
2326 query = new StringBundler(6);
2327 }
2328
2329 query.append(_SQL_SELECT_PHONE_WHERE);
2330
2331 query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
2332
2333 query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
2334
2335 query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
2336
2337 query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
2338
2339 if (orderByComparator != null) {
2340 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2341 orderByComparator);
2342 }
2343
2344 else {
2345 query.append(PhoneModelImpl.ORDER_BY_JPQL);
2346 }
2347
2348 String sql = query.toString();
2349
2350 Session session = null;
2351
2352 try {
2353 session = openSession();
2354
2355 Query q = session.createQuery(sql);
2356
2357 QueryPos qPos = QueryPos.getInstance(q);
2358
2359 qPos.add(companyId);
2360
2361 qPos.add(classNameId);
2362
2363 qPos.add(classPK);
2364
2365 qPos.add(primary);
2366
2367 list = (List<Phone>)QueryUtil.list(q, getDialect(), start, end);
2368 }
2369 catch (Exception e) {
2370 throw processException(e);
2371 }
2372 finally {
2373 if (list == null) {
2374 FinderCacheUtil.removeResult(finderPath, finderArgs);
2375 }
2376 else {
2377 cacheResult(list);
2378
2379 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2380 }
2381
2382 closeSession(session);
2383 }
2384 }
2385
2386 return list;
2387 }
2388
2389
2401 public Phone findByC_C_C_P_First(long companyId, long classNameId,
2402 long classPK, boolean primary, OrderByComparator orderByComparator)
2403 throws NoSuchPhoneException, SystemException {
2404 Phone phone = fetchByC_C_C_P_First(companyId, classNameId, classPK,
2405 primary, orderByComparator);
2406
2407 if (phone != null) {
2408 return phone;
2409 }
2410
2411 StringBundler msg = new StringBundler(10);
2412
2413 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2414
2415 msg.append("companyId=");
2416 msg.append(companyId);
2417
2418 msg.append(", classNameId=");
2419 msg.append(classNameId);
2420
2421 msg.append(", classPK=");
2422 msg.append(classPK);
2423
2424 msg.append(", primary=");
2425 msg.append(primary);
2426
2427 msg.append(StringPool.CLOSE_CURLY_BRACE);
2428
2429 throw new NoSuchPhoneException(msg.toString());
2430 }
2431
2432
2443 public Phone fetchByC_C_C_P_First(long companyId, long classNameId,
2444 long classPK, boolean primary, OrderByComparator orderByComparator)
2445 throws SystemException {
2446 List<Phone> list = findByC_C_C_P(companyId, classNameId, classPK,
2447 primary, 0, 1, orderByComparator);
2448
2449 if (!list.isEmpty()) {
2450 return list.get(0);
2451 }
2452
2453 return null;
2454 }
2455
2456
2468 public Phone findByC_C_C_P_Last(long companyId, long classNameId,
2469 long classPK, boolean primary, OrderByComparator orderByComparator)
2470 throws NoSuchPhoneException, SystemException {
2471 Phone phone = fetchByC_C_C_P_Last(companyId, classNameId, classPK,
2472 primary, orderByComparator);
2473
2474 if (phone != null) {
2475 return phone;
2476 }
2477
2478 StringBundler msg = new StringBundler(10);
2479
2480 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2481
2482 msg.append("companyId=");
2483 msg.append(companyId);
2484
2485 msg.append(", classNameId=");
2486 msg.append(classNameId);
2487
2488 msg.append(", classPK=");
2489 msg.append(classPK);
2490
2491 msg.append(", primary=");
2492 msg.append(primary);
2493
2494 msg.append(StringPool.CLOSE_CURLY_BRACE);
2495
2496 throw new NoSuchPhoneException(msg.toString());
2497 }
2498
2499
2510 public Phone fetchByC_C_C_P_Last(long companyId, long classNameId,
2511 long classPK, boolean primary, OrderByComparator orderByComparator)
2512 throws SystemException {
2513 int count = countByC_C_C_P(companyId, classNameId, classPK, primary);
2514
2515 List<Phone> list = findByC_C_C_P(companyId, classNameId, classPK,
2516 primary, count - 1, count, orderByComparator);
2517
2518 if (!list.isEmpty()) {
2519 return list.get(0);
2520 }
2521
2522 return null;
2523 }
2524
2525
2538 public Phone[] findByC_C_C_P_PrevAndNext(long phoneId, long companyId,
2539 long classNameId, long classPK, boolean primary,
2540 OrderByComparator orderByComparator)
2541 throws NoSuchPhoneException, SystemException {
2542 Phone phone = findByPrimaryKey(phoneId);
2543
2544 Session session = null;
2545
2546 try {
2547 session = openSession();
2548
2549 Phone[] array = new PhoneImpl[3];
2550
2551 array[0] = getByC_C_C_P_PrevAndNext(session, phone, companyId,
2552 classNameId, classPK, primary, orderByComparator, true);
2553
2554 array[1] = phone;
2555
2556 array[2] = getByC_C_C_P_PrevAndNext(session, phone, companyId,
2557 classNameId, classPK, primary, orderByComparator, false);
2558
2559 return array;
2560 }
2561 catch (Exception e) {
2562 throw processException(e);
2563 }
2564 finally {
2565 closeSession(session);
2566 }
2567 }
2568
2569 protected Phone getByC_C_C_P_PrevAndNext(Session session, Phone phone,
2570 long companyId, long classNameId, long classPK, boolean primary,
2571 OrderByComparator orderByComparator, boolean previous) {
2572 StringBundler query = null;
2573
2574 if (orderByComparator != null) {
2575 query = new StringBundler(6 +
2576 (orderByComparator.getOrderByFields().length * 6));
2577 }
2578 else {
2579 query = new StringBundler(3);
2580 }
2581
2582 query.append(_SQL_SELECT_PHONE_WHERE);
2583
2584 query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
2585
2586 query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
2587
2588 query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
2589
2590 query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
2591
2592 if (orderByComparator != null) {
2593 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2594
2595 if (orderByConditionFields.length > 0) {
2596 query.append(WHERE_AND);
2597 }
2598
2599 for (int i = 0; i < orderByConditionFields.length; i++) {
2600 query.append(_ORDER_BY_ENTITY_ALIAS);
2601 query.append(orderByConditionFields[i]);
2602
2603 if ((i + 1) < orderByConditionFields.length) {
2604 if (orderByComparator.isAscending() ^ previous) {
2605 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2606 }
2607 else {
2608 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2609 }
2610 }
2611 else {
2612 if (orderByComparator.isAscending() ^ previous) {
2613 query.append(WHERE_GREATER_THAN);
2614 }
2615 else {
2616 query.append(WHERE_LESSER_THAN);
2617 }
2618 }
2619 }
2620
2621 query.append(ORDER_BY_CLAUSE);
2622
2623 String[] orderByFields = orderByComparator.getOrderByFields();
2624
2625 for (int i = 0; i < orderByFields.length; i++) {
2626 query.append(_ORDER_BY_ENTITY_ALIAS);
2627 query.append(orderByFields[i]);
2628
2629 if ((i + 1) < orderByFields.length) {
2630 if (orderByComparator.isAscending() ^ previous) {
2631 query.append(ORDER_BY_ASC_HAS_NEXT);
2632 }
2633 else {
2634 query.append(ORDER_BY_DESC_HAS_NEXT);
2635 }
2636 }
2637 else {
2638 if (orderByComparator.isAscending() ^ previous) {
2639 query.append(ORDER_BY_ASC);
2640 }
2641 else {
2642 query.append(ORDER_BY_DESC);
2643 }
2644 }
2645 }
2646 }
2647
2648 else {
2649 query.append(PhoneModelImpl.ORDER_BY_JPQL);
2650 }
2651
2652 String sql = query.toString();
2653
2654 Query q = session.createQuery(sql);
2655
2656 q.setFirstResult(0);
2657 q.setMaxResults(2);
2658
2659 QueryPos qPos = QueryPos.getInstance(q);
2660
2661 qPos.add(companyId);
2662
2663 qPos.add(classNameId);
2664
2665 qPos.add(classPK);
2666
2667 qPos.add(primary);
2668
2669 if (orderByComparator != null) {
2670 Object[] values = orderByComparator.getOrderByConditionValues(phone);
2671
2672 for (Object value : values) {
2673 qPos.add(value);
2674 }
2675 }
2676
2677 List<Phone> list = q.list();
2678
2679 if (list.size() == 2) {
2680 return list.get(1);
2681 }
2682 else {
2683 return null;
2684 }
2685 }
2686
2687
2693 public List<Phone> findAll() throws SystemException {
2694 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2695 }
2696
2697
2709 public List<Phone> findAll(int start, int end) throws SystemException {
2710 return findAll(start, end, null);
2711 }
2712
2713
2726 public List<Phone> findAll(int start, int end,
2727 OrderByComparator orderByComparator) throws SystemException {
2728 FinderPath finderPath = null;
2729 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2730
2731 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2732 (orderByComparator == null)) {
2733 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2734 finderArgs = FINDER_ARGS_EMPTY;
2735 }
2736 else {
2737 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2738 finderArgs = new Object[] { start, end, orderByComparator };
2739 }
2740
2741 List<Phone> list = (List<Phone>)FinderCacheUtil.getResult(finderPath,
2742 finderArgs, this);
2743
2744 if (list == null) {
2745 StringBundler query = null;
2746 String sql = null;
2747
2748 if (orderByComparator != null) {
2749 query = new StringBundler(2 +
2750 (orderByComparator.getOrderByFields().length * 3));
2751
2752 query.append(_SQL_SELECT_PHONE);
2753
2754 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2755 orderByComparator);
2756
2757 sql = query.toString();
2758 }
2759 else {
2760 sql = _SQL_SELECT_PHONE.concat(PhoneModelImpl.ORDER_BY_JPQL);
2761 }
2762
2763 Session session = null;
2764
2765 try {
2766 session = openSession();
2767
2768 Query q = session.createQuery(sql);
2769
2770 if (orderByComparator == null) {
2771 list = (List<Phone>)QueryUtil.list(q, getDialect(), start,
2772 end, false);
2773
2774 Collections.sort(list);
2775 }
2776 else {
2777 list = (List<Phone>)QueryUtil.list(q, getDialect(), start,
2778 end);
2779 }
2780 }
2781 catch (Exception e) {
2782 throw processException(e);
2783 }
2784 finally {
2785 if (list == null) {
2786 FinderCacheUtil.removeResult(finderPath, finderArgs);
2787 }
2788 else {
2789 cacheResult(list);
2790
2791 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2792 }
2793
2794 closeSession(session);
2795 }
2796 }
2797
2798 return list;
2799 }
2800
2801
2807 public void removeByCompanyId(long companyId) throws SystemException {
2808 for (Phone phone : findByCompanyId(companyId)) {
2809 remove(phone);
2810 }
2811 }
2812
2813
2819 public void removeByUserId(long userId) throws SystemException {
2820 for (Phone phone : findByUserId(userId)) {
2821 remove(phone);
2822 }
2823 }
2824
2825
2832 public void removeByC_C(long companyId, long classNameId)
2833 throws SystemException {
2834 for (Phone phone : findByC_C(companyId, classNameId)) {
2835 remove(phone);
2836 }
2837 }
2838
2839
2847 public void removeByC_C_C(long companyId, long classNameId, long classPK)
2848 throws SystemException {
2849 for (Phone phone : findByC_C_C(companyId, classNameId, classPK)) {
2850 remove(phone);
2851 }
2852 }
2853
2854
2863 public void removeByC_C_C_P(long companyId, long classNameId, long classPK,
2864 boolean primary) throws SystemException {
2865 for (Phone phone : findByC_C_C_P(companyId, classNameId, classPK,
2866 primary)) {
2867 remove(phone);
2868 }
2869 }
2870
2871
2876 public void removeAll() throws SystemException {
2877 for (Phone phone : findAll()) {
2878 remove(phone);
2879 }
2880 }
2881
2882
2889 public int countByCompanyId(long companyId) throws SystemException {
2890 Object[] finderArgs = new Object[] { companyId };
2891
2892 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2893 finderArgs, this);
2894
2895 if (count == null) {
2896 StringBundler query = new StringBundler(2);
2897
2898 query.append(_SQL_COUNT_PHONE_WHERE);
2899
2900 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2901
2902 String sql = query.toString();
2903
2904 Session session = null;
2905
2906 try {
2907 session = openSession();
2908
2909 Query q = session.createQuery(sql);
2910
2911 QueryPos qPos = QueryPos.getInstance(q);
2912
2913 qPos.add(companyId);
2914
2915 count = (Long)q.uniqueResult();
2916 }
2917 catch (Exception e) {
2918 throw processException(e);
2919 }
2920 finally {
2921 if (count == null) {
2922 count = Long.valueOf(0);
2923 }
2924
2925 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2926 finderArgs, count);
2927
2928 closeSession(session);
2929 }
2930 }
2931
2932 return count.intValue();
2933 }
2934
2935
2942 public int countByUserId(long userId) throws SystemException {
2943 Object[] finderArgs = new Object[] { userId };
2944
2945 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
2946 finderArgs, this);
2947
2948 if (count == null) {
2949 StringBundler query = new StringBundler(2);
2950
2951 query.append(_SQL_COUNT_PHONE_WHERE);
2952
2953 query.append(_FINDER_COLUMN_USERID_USERID_2);
2954
2955 String sql = query.toString();
2956
2957 Session session = null;
2958
2959 try {
2960 session = openSession();
2961
2962 Query q = session.createQuery(sql);
2963
2964 QueryPos qPos = QueryPos.getInstance(q);
2965
2966 qPos.add(userId);
2967
2968 count = (Long)q.uniqueResult();
2969 }
2970 catch (Exception e) {
2971 throw processException(e);
2972 }
2973 finally {
2974 if (count == null) {
2975 count = Long.valueOf(0);
2976 }
2977
2978 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
2979 finderArgs, count);
2980
2981 closeSession(session);
2982 }
2983 }
2984
2985 return count.intValue();
2986 }
2987
2988
2996 public int countByC_C(long companyId, long classNameId)
2997 throws SystemException {
2998 Object[] finderArgs = new Object[] { companyId, classNameId };
2999
3000 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
3001 finderArgs, this);
3002
3003 if (count == null) {
3004 StringBundler query = new StringBundler(3);
3005
3006 query.append(_SQL_COUNT_PHONE_WHERE);
3007
3008 query.append(_FINDER_COLUMN_C_C_COMPANYID_2);
3009
3010 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3011
3012 String sql = query.toString();
3013
3014 Session session = null;
3015
3016 try {
3017 session = openSession();
3018
3019 Query q = session.createQuery(sql);
3020
3021 QueryPos qPos = QueryPos.getInstance(q);
3022
3023 qPos.add(companyId);
3024
3025 qPos.add(classNameId);
3026
3027 count = (Long)q.uniqueResult();
3028 }
3029 catch (Exception e) {
3030 throw processException(e);
3031 }
3032 finally {
3033 if (count == null) {
3034 count = Long.valueOf(0);
3035 }
3036
3037 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
3038 count);
3039
3040 closeSession(session);
3041 }
3042 }
3043
3044 return count.intValue();
3045 }
3046
3047
3056 public int countByC_C_C(long companyId, long classNameId, long classPK)
3057 throws SystemException {
3058 Object[] finderArgs = new Object[] { companyId, classNameId, classPK };
3059
3060 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_C,
3061 finderArgs, this);
3062
3063 if (count == null) {
3064 StringBundler query = new StringBundler(4);
3065
3066 query.append(_SQL_COUNT_PHONE_WHERE);
3067
3068 query.append(_FINDER_COLUMN_C_C_C_COMPANYID_2);
3069
3070 query.append(_FINDER_COLUMN_C_C_C_CLASSNAMEID_2);
3071
3072 query.append(_FINDER_COLUMN_C_C_C_CLASSPK_2);
3073
3074 String sql = query.toString();
3075
3076 Session session = null;
3077
3078 try {
3079 session = openSession();
3080
3081 Query q = session.createQuery(sql);
3082
3083 QueryPos qPos = QueryPos.getInstance(q);
3084
3085 qPos.add(companyId);
3086
3087 qPos.add(classNameId);
3088
3089 qPos.add(classPK);
3090
3091 count = (Long)q.uniqueResult();
3092 }
3093 catch (Exception e) {
3094 throw processException(e);
3095 }
3096 finally {
3097 if (count == null) {
3098 count = Long.valueOf(0);
3099 }
3100
3101 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_C,
3102 finderArgs, count);
3103
3104 closeSession(session);
3105 }
3106 }
3107
3108 return count.intValue();
3109 }
3110
3111
3121 public int countByC_C_C_P(long companyId, long classNameId, long classPK,
3122 boolean primary) throws SystemException {
3123 Object[] finderArgs = new Object[] {
3124 companyId, classNameId, classPK, primary
3125 };
3126
3127 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_C_P,
3128 finderArgs, this);
3129
3130 if (count == null) {
3131 StringBundler query = new StringBundler(5);
3132
3133 query.append(_SQL_COUNT_PHONE_WHERE);
3134
3135 query.append(_FINDER_COLUMN_C_C_C_P_COMPANYID_2);
3136
3137 query.append(_FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2);
3138
3139 query.append(_FINDER_COLUMN_C_C_C_P_CLASSPK_2);
3140
3141 query.append(_FINDER_COLUMN_C_C_C_P_PRIMARY_2);
3142
3143 String sql = query.toString();
3144
3145 Session session = null;
3146
3147 try {
3148 session = openSession();
3149
3150 Query q = session.createQuery(sql);
3151
3152 QueryPos qPos = QueryPos.getInstance(q);
3153
3154 qPos.add(companyId);
3155
3156 qPos.add(classNameId);
3157
3158 qPos.add(classPK);
3159
3160 qPos.add(primary);
3161
3162 count = (Long)q.uniqueResult();
3163 }
3164 catch (Exception e) {
3165 throw processException(e);
3166 }
3167 finally {
3168 if (count == null) {
3169 count = Long.valueOf(0);
3170 }
3171
3172 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_C_P,
3173 finderArgs, count);
3174
3175 closeSession(session);
3176 }
3177 }
3178
3179 return count.intValue();
3180 }
3181
3182
3188 public int countAll() throws SystemException {
3189 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3190 FINDER_ARGS_EMPTY, this);
3191
3192 if (count == null) {
3193 Session session = null;
3194
3195 try {
3196 session = openSession();
3197
3198 Query q = session.createQuery(_SQL_COUNT_PHONE);
3199
3200 count = (Long)q.uniqueResult();
3201 }
3202 catch (Exception e) {
3203 throw processException(e);
3204 }
3205 finally {
3206 if (count == null) {
3207 count = Long.valueOf(0);
3208 }
3209
3210 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3211 FINDER_ARGS_EMPTY, count);
3212
3213 closeSession(session);
3214 }
3215 }
3216
3217 return count.intValue();
3218 }
3219
3220
3223 public void afterPropertiesSet() {
3224 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3225 com.liferay.portal.util.PropsUtil.get(
3226 "value.object.listener.com.liferay.portal.model.Phone")));
3227
3228 if (listenerClassNames.length > 0) {
3229 try {
3230 List<ModelListener<Phone>> listenersList = new ArrayList<ModelListener<Phone>>();
3231
3232 for (String listenerClassName : listenerClassNames) {
3233 Class<?> clazz = getClass();
3234
3235 listenersList.add((ModelListener<Phone>)InstanceFactory.newInstance(
3236 clazz.getClassLoader(), listenerClassName));
3237 }
3238
3239 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3240 }
3241 catch (Exception e) {
3242 _log.error(e);
3243 }
3244 }
3245 }
3246
3247 public void destroy() {
3248 EntityCacheUtil.removeCache(PhoneImpl.class.getName());
3249 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3250 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3251 }
3252
3253 @BeanReference(type = AccountPersistence.class)
3254 protected AccountPersistence accountPersistence;
3255 @BeanReference(type = AddressPersistence.class)
3256 protected AddressPersistence addressPersistence;
3257 @BeanReference(type = BrowserTrackerPersistence.class)
3258 protected BrowserTrackerPersistence browserTrackerPersistence;
3259 @BeanReference(type = ClassNamePersistence.class)
3260 protected ClassNamePersistence classNamePersistence;
3261 @BeanReference(type = ClusterGroupPersistence.class)
3262 protected ClusterGroupPersistence clusterGroupPersistence;
3263 @BeanReference(type = CompanyPersistence.class)
3264 protected CompanyPersistence companyPersistence;
3265 @BeanReference(type = ContactPersistence.class)
3266 protected ContactPersistence contactPersistence;
3267 @BeanReference(type = CountryPersistence.class)
3268 protected CountryPersistence countryPersistence;
3269 @BeanReference(type = EmailAddressPersistence.class)
3270 protected EmailAddressPersistence emailAddressPersistence;
3271 @BeanReference(type = GroupPersistence.class)
3272 protected GroupPersistence groupPersistence;
3273 @BeanReference(type = ImagePersistence.class)
3274 protected ImagePersistence imagePersistence;
3275 @BeanReference(type = LayoutPersistence.class)
3276 protected LayoutPersistence layoutPersistence;
3277 @BeanReference(type = LayoutBranchPersistence.class)
3278 protected LayoutBranchPersistence layoutBranchPersistence;
3279 @BeanReference(type = LayoutPrototypePersistence.class)
3280 protected LayoutPrototypePersistence layoutPrototypePersistence;
3281 @BeanReference(type = LayoutRevisionPersistence.class)
3282 protected LayoutRevisionPersistence layoutRevisionPersistence;
3283 @BeanReference(type = LayoutSetPersistence.class)
3284 protected LayoutSetPersistence layoutSetPersistence;
3285 @BeanReference(type = LayoutSetBranchPersistence.class)
3286 protected LayoutSetBranchPersistence layoutSetBranchPersistence;
3287 @BeanReference(type = LayoutSetPrototypePersistence.class)
3288 protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
3289 @BeanReference(type = ListTypePersistence.class)
3290 protected ListTypePersistence listTypePersistence;
3291 @BeanReference(type = LockPersistence.class)
3292 protected LockPersistence lockPersistence;
3293 @BeanReference(type = MembershipRequestPersistence.class)
3294 protected MembershipRequestPersistence membershipRequestPersistence;
3295 @BeanReference(type = OrganizationPersistence.class)
3296 protected OrganizationPersistence organizationPersistence;
3297 @BeanReference(type = OrgGroupPermissionPersistence.class)
3298 protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
3299 @BeanReference(type = OrgGroupRolePersistence.class)
3300 protected OrgGroupRolePersistence orgGroupRolePersistence;
3301 @BeanReference(type = OrgLaborPersistence.class)
3302 protected OrgLaborPersistence orgLaborPersistence;
3303 @BeanReference(type = PasswordPolicyPersistence.class)
3304 protected PasswordPolicyPersistence passwordPolicyPersistence;
3305 @BeanReference(type = PasswordPolicyRelPersistence.class)
3306 protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
3307 @BeanReference(type = PasswordTrackerPersistence.class)
3308 protected PasswordTrackerPersistence passwordTrackerPersistence;
3309 @BeanReference(type = PermissionPersistence.class)
3310 protected PermissionPersistence permissionPersistence;
3311 @BeanReference(type = PhonePersistence.class)
3312 protected PhonePersistence phonePersistence;
3313 @BeanReference(type = PluginSettingPersistence.class)
3314 protected PluginSettingPersistence pluginSettingPersistence;
3315 @BeanReference(type = PortalPreferencesPersistence.class)
3316 protected PortalPreferencesPersistence portalPreferencesPersistence;
3317 @BeanReference(type = PortletPersistence.class)
3318 protected PortletPersistence portletPersistence;
3319 @BeanReference(type = PortletItemPersistence.class)
3320 protected PortletItemPersistence portletItemPersistence;
3321 @BeanReference(type = PortletPreferencesPersistence.class)
3322 protected PortletPreferencesPersistence portletPreferencesPersistence;
3323 @BeanReference(type = RegionPersistence.class)
3324 protected RegionPersistence regionPersistence;
3325 @BeanReference(type = ReleasePersistence.class)
3326 protected ReleasePersistence releasePersistence;
3327 @BeanReference(type = RepositoryPersistence.class)
3328 protected RepositoryPersistence repositoryPersistence;
3329 @BeanReference(type = RepositoryEntryPersistence.class)
3330 protected RepositoryEntryPersistence repositoryEntryPersistence;
3331 @BeanReference(type = ResourcePersistence.class)
3332 protected ResourcePersistence resourcePersistence;
3333 @BeanReference(type = ResourceActionPersistence.class)
3334 protected ResourceActionPersistence resourceActionPersistence;
3335 @BeanReference(type = ResourceBlockPersistence.class)
3336 protected ResourceBlockPersistence resourceBlockPersistence;
3337 @BeanReference(type = ResourceBlockPermissionPersistence.class)
3338 protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
3339 @BeanReference(type = ResourceCodePersistence.class)
3340 protected ResourceCodePersistence resourceCodePersistence;
3341 @BeanReference(type = ResourcePermissionPersistence.class)
3342 protected ResourcePermissionPersistence resourcePermissionPersistence;
3343 @BeanReference(type = ResourceTypePermissionPersistence.class)
3344 protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
3345 @BeanReference(type = RolePersistence.class)
3346 protected RolePersistence rolePersistence;
3347 @BeanReference(type = ServiceComponentPersistence.class)
3348 protected ServiceComponentPersistence serviceComponentPersistence;
3349 @BeanReference(type = ShardPersistence.class)
3350 protected ShardPersistence shardPersistence;
3351 @BeanReference(type = SubscriptionPersistence.class)
3352 protected SubscriptionPersistence subscriptionPersistence;
3353 @BeanReference(type = TeamPersistence.class)
3354 protected TeamPersistence teamPersistence;
3355 @BeanReference(type = TicketPersistence.class)
3356 protected TicketPersistence ticketPersistence;
3357 @BeanReference(type = UserPersistence.class)
3358 protected UserPersistence userPersistence;
3359 @BeanReference(type = UserGroupPersistence.class)
3360 protected UserGroupPersistence userGroupPersistence;
3361 @BeanReference(type = UserGroupGroupRolePersistence.class)
3362 protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
3363 @BeanReference(type = UserGroupRolePersistence.class)
3364 protected UserGroupRolePersistence userGroupRolePersistence;
3365 @BeanReference(type = UserIdMapperPersistence.class)
3366 protected UserIdMapperPersistence userIdMapperPersistence;
3367 @BeanReference(type = UserNotificationEventPersistence.class)
3368 protected UserNotificationEventPersistence userNotificationEventPersistence;
3369 @BeanReference(type = UserTrackerPersistence.class)
3370 protected UserTrackerPersistence userTrackerPersistence;
3371 @BeanReference(type = UserTrackerPathPersistence.class)
3372 protected UserTrackerPathPersistence userTrackerPathPersistence;
3373 @BeanReference(type = VirtualHostPersistence.class)
3374 protected VirtualHostPersistence virtualHostPersistence;
3375 @BeanReference(type = WebDAVPropsPersistence.class)
3376 protected WebDAVPropsPersistence webDAVPropsPersistence;
3377 @BeanReference(type = WebsitePersistence.class)
3378 protected WebsitePersistence websitePersistence;
3379 @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
3380 protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
3381 @BeanReference(type = WorkflowInstanceLinkPersistence.class)
3382 protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
3383 private static final String _SQL_SELECT_PHONE = "SELECT phone FROM Phone phone";
3384 private static final String _SQL_SELECT_PHONE_WHERE = "SELECT phone FROM Phone phone WHERE ";
3385 private static final String _SQL_COUNT_PHONE = "SELECT COUNT(phone) FROM Phone phone";
3386 private static final String _SQL_COUNT_PHONE_WHERE = "SELECT COUNT(phone) FROM Phone phone WHERE ";
3387 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "phone.companyId = ?";
3388 private static final String _FINDER_COLUMN_USERID_USERID_2 = "phone.userId = ?";
3389 private static final String _FINDER_COLUMN_C_C_COMPANYID_2 = "phone.companyId = ? AND ";
3390 private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "phone.classNameId = ?";
3391 private static final String _FINDER_COLUMN_C_C_C_COMPANYID_2 = "phone.companyId = ? AND ";
3392 private static final String _FINDER_COLUMN_C_C_C_CLASSNAMEID_2 = "phone.classNameId = ? AND ";
3393 private static final String _FINDER_COLUMN_C_C_C_CLASSPK_2 = "phone.classPK = ?";
3394 private static final String _FINDER_COLUMN_C_C_C_P_COMPANYID_2 = "phone.companyId = ? AND ";
3395 private static final String _FINDER_COLUMN_C_C_C_P_CLASSNAMEID_2 = "phone.classNameId = ? AND ";
3396 private static final String _FINDER_COLUMN_C_C_C_P_CLASSPK_2 = "phone.classPK = ? AND ";
3397 private static final String _FINDER_COLUMN_C_C_C_P_PRIMARY_2 = "phone.primary = ?";
3398 private static final String _ORDER_BY_ENTITY_ALIAS = "phone.";
3399 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Phone exists with the primary key ";
3400 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Phone exists with the key {";
3401 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3402 private static Log _log = LogFactoryUtil.getLog(PhonePersistenceImpl.class);
3403 private static Phone _nullPhone = new PhoneImpl() {
3404 @Override
3405 public Object clone() {
3406 return this;
3407 }
3408
3409 @Override
3410 public CacheModel<Phone> toCacheModel() {
3411 return _nullPhoneCacheModel;
3412 }
3413 };
3414
3415 private static CacheModel<Phone> _nullPhoneCacheModel = new CacheModel<Phone>() {
3416 public Phone toEntityModel() {
3417 return _nullPhone;
3418 }
3419 };
3420 }