1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.service.persistence;
16  
17  import com.liferay.portal.NoSuchContactException;
18  import com.liferay.portal.NoSuchModelException;
19  import com.liferay.portal.kernel.annotation.BeanReference;
20  import com.liferay.portal.kernel.cache.CacheRegistry;
21  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
22  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
23  import com.liferay.portal.kernel.dao.orm.FinderPath;
24  import com.liferay.portal.kernel.dao.orm.Query;
25  import com.liferay.portal.kernel.dao.orm.QueryPos;
26  import com.liferay.portal.kernel.dao.orm.QueryUtil;
27  import com.liferay.portal.kernel.dao.orm.Session;
28  import com.liferay.portal.kernel.exception.SystemException;
29  import com.liferay.portal.kernel.log.Log;
30  import com.liferay.portal.kernel.log.LogFactoryUtil;
31  import com.liferay.portal.kernel.util.GetterUtil;
32  import com.liferay.portal.kernel.util.OrderByComparator;
33  import com.liferay.portal.kernel.util.StringBundler;
34  import com.liferay.portal.kernel.util.StringPool;
35  import com.liferay.portal.kernel.util.StringUtil;
36  import com.liferay.portal.model.Contact;
37  import com.liferay.portal.model.ModelListener;
38  import com.liferay.portal.model.impl.ContactImpl;
39  import com.liferay.portal.model.impl.ContactModelImpl;
40  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
41  
42  import java.io.Serializable;
43  
44  import java.util.ArrayList;
45  import java.util.Collections;
46  import java.util.List;
47  
48  /**
49   * <a href="ContactPersistenceImpl.java.html"><b><i>View Source</i></b></a>
50   *
51   * <p>
52   * ServiceBuilder generated this class. Modifications in this class will be
53   * overwritten the next time is generated.
54   * </p>
55   *
56   * @author    Brian Wing Shun Chan
57   * @see       ContactPersistence
58   * @see       ContactUtil
59   * @generated
60   */
61  public class ContactPersistenceImpl extends BasePersistenceImpl<Contact>
62      implements ContactPersistence {
63      public static final String FINDER_CLASS_NAME_ENTITY = ContactImpl.class.getName();
64      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
65          ".List";
66      public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(ContactModelImpl.ENTITY_CACHE_ENABLED,
67              ContactModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
68              "findByCompanyId", new String[] { Long.class.getName() });
69      public static final FinderPath FINDER_PATH_FIND_BY_OBC_COMPANYID = new FinderPath(ContactModelImpl.ENTITY_CACHE_ENABLED,
70              ContactModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
71              "findByCompanyId",
72              new String[] {
73                  Long.class.getName(),
74                  
75              "java.lang.Integer", "java.lang.Integer",
76                  "com.liferay.portal.kernel.util.OrderByComparator"
77              });
78      public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(ContactModelImpl.ENTITY_CACHE_ENABLED,
79              ContactModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
80              "countByCompanyId", new String[] { Long.class.getName() });
81      public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(ContactModelImpl.ENTITY_CACHE_ENABLED,
82              ContactModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
83              "findAll", new String[0]);
84      public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ContactModelImpl.ENTITY_CACHE_ENABLED,
85              ContactModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
86              "countAll", new String[0]);
87  
88      public void cacheResult(Contact contact) {
89          EntityCacheUtil.putResult(ContactModelImpl.ENTITY_CACHE_ENABLED,
90              ContactImpl.class, contact.getPrimaryKey(), contact);
91      }
92  
93      public void cacheResult(List<Contact> contacts) {
94          for (Contact contact : contacts) {
95              if (EntityCacheUtil.getResult(
96                          ContactModelImpl.ENTITY_CACHE_ENABLED,
97                          ContactImpl.class, contact.getPrimaryKey(), this) == null) {
98                  cacheResult(contact);
99              }
100         }
101     }
102 
103     public void clearCache() {
104         CacheRegistry.clear(ContactImpl.class.getName());
105         EntityCacheUtil.clearCache(ContactImpl.class.getName());
106         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
107         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
108     }
109 
110     public Contact create(long contactId) {
111         Contact contact = new ContactImpl();
112 
113         contact.setNew(true);
114         contact.setPrimaryKey(contactId);
115 
116         return contact;
117     }
118 
119     public Contact remove(Serializable primaryKey)
120         throws NoSuchModelException, SystemException {
121         return remove(((Long)primaryKey).longValue());
122     }
123 
124     public Contact remove(long contactId)
125         throws NoSuchContactException, SystemException {
126         Session session = null;
127 
128         try {
129             session = openSession();
130 
131             Contact contact = (Contact)session.get(ContactImpl.class,
132                     new Long(contactId));
133 
134             if (contact == null) {
135                 if (_log.isWarnEnabled()) {
136                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + contactId);
137                 }
138 
139                 throw new NoSuchContactException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
140                     contactId);
141             }
142 
143             return remove(contact);
144         }
145         catch (NoSuchContactException nsee) {
146             throw nsee;
147         }
148         catch (Exception e) {
149             throw processException(e);
150         }
151         finally {
152             closeSession(session);
153         }
154     }
155 
156     public Contact remove(Contact contact) throws SystemException {
157         for (ModelListener<Contact> listener : listeners) {
158             listener.onBeforeRemove(contact);
159         }
160 
161         contact = removeImpl(contact);
162 
163         for (ModelListener<Contact> listener : listeners) {
164             listener.onAfterRemove(contact);
165         }
166 
167         return contact;
168     }
169 
170     protected Contact removeImpl(Contact contact) throws SystemException {
171         contact = toUnwrappedModel(contact);
172 
173         Session session = null;
174 
175         try {
176             session = openSession();
177 
178             if (contact.isCachedModel() || BatchSessionUtil.isEnabled()) {
179                 Object staleObject = session.get(ContactImpl.class,
180                         contact.getPrimaryKeyObj());
181 
182                 if (staleObject != null) {
183                     session.evict(staleObject);
184                 }
185             }
186 
187             session.delete(contact);
188 
189             session.flush();
190         }
191         catch (Exception e) {
192             throw processException(e);
193         }
194         finally {
195             closeSession(session);
196         }
197 
198         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
199 
200         EntityCacheUtil.removeResult(ContactModelImpl.ENTITY_CACHE_ENABLED,
201             ContactImpl.class, contact.getPrimaryKey());
202 
203         return contact;
204     }
205 
206     public Contact updateImpl(com.liferay.portal.model.Contact contact,
207         boolean merge) throws SystemException {
208         contact = toUnwrappedModel(contact);
209 
210         Session session = null;
211 
212         try {
213             session = openSession();
214 
215             BatchSessionUtil.update(session, contact, merge);
216 
217             contact.setNew(false);
218         }
219         catch (Exception e) {
220             throw processException(e);
221         }
222         finally {
223             closeSession(session);
224         }
225 
226         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
227 
228         EntityCacheUtil.putResult(ContactModelImpl.ENTITY_CACHE_ENABLED,
229             ContactImpl.class, contact.getPrimaryKey(), contact);
230 
231         return contact;
232     }
233 
234     protected Contact toUnwrappedModel(Contact contact) {
235         if (contact instanceof ContactImpl) {
236             return contact;
237         }
238 
239         ContactImpl contactImpl = new ContactImpl();
240 
241         contactImpl.setNew(contact.isNew());
242         contactImpl.setPrimaryKey(contact.getPrimaryKey());
243 
244         contactImpl.setContactId(contact.getContactId());
245         contactImpl.setCompanyId(contact.getCompanyId());
246         contactImpl.setUserId(contact.getUserId());
247         contactImpl.setUserName(contact.getUserName());
248         contactImpl.setCreateDate(contact.getCreateDate());
249         contactImpl.setModifiedDate(contact.getModifiedDate());
250         contactImpl.setAccountId(contact.getAccountId());
251         contactImpl.setParentContactId(contact.getParentContactId());
252         contactImpl.setFirstName(contact.getFirstName());
253         contactImpl.setMiddleName(contact.getMiddleName());
254         contactImpl.setLastName(contact.getLastName());
255         contactImpl.setPrefixId(contact.getPrefixId());
256         contactImpl.setSuffixId(contact.getSuffixId());
257         contactImpl.setMale(contact.isMale());
258         contactImpl.setBirthday(contact.getBirthday());
259         contactImpl.setSmsSn(contact.getSmsSn());
260         contactImpl.setAimSn(contact.getAimSn());
261         contactImpl.setFacebookSn(contact.getFacebookSn());
262         contactImpl.setIcqSn(contact.getIcqSn());
263         contactImpl.setJabberSn(contact.getJabberSn());
264         contactImpl.setMsnSn(contact.getMsnSn());
265         contactImpl.setMySpaceSn(contact.getMySpaceSn());
266         contactImpl.setSkypeSn(contact.getSkypeSn());
267         contactImpl.setTwitterSn(contact.getTwitterSn());
268         contactImpl.setYmSn(contact.getYmSn());
269         contactImpl.setEmployeeStatusId(contact.getEmployeeStatusId());
270         contactImpl.setEmployeeNumber(contact.getEmployeeNumber());
271         contactImpl.setJobTitle(contact.getJobTitle());
272         contactImpl.setJobClass(contact.getJobClass());
273         contactImpl.setHoursOfOperation(contact.getHoursOfOperation());
274 
275         return contactImpl;
276     }
277 
278     public Contact findByPrimaryKey(Serializable primaryKey)
279         throws NoSuchModelException, SystemException {
280         return findByPrimaryKey(((Long)primaryKey).longValue());
281     }
282 
283     public Contact findByPrimaryKey(long contactId)
284         throws NoSuchContactException, SystemException {
285         Contact contact = fetchByPrimaryKey(contactId);
286 
287         if (contact == null) {
288             if (_log.isWarnEnabled()) {
289                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + contactId);
290             }
291 
292             throw new NoSuchContactException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
293                 contactId);
294         }
295 
296         return contact;
297     }
298 
299     public Contact fetchByPrimaryKey(Serializable primaryKey)
300         throws SystemException {
301         return fetchByPrimaryKey(((Long)primaryKey).longValue());
302     }
303 
304     public Contact fetchByPrimaryKey(long contactId) throws SystemException {
305         Contact contact = (Contact)EntityCacheUtil.getResult(ContactModelImpl.ENTITY_CACHE_ENABLED,
306                 ContactImpl.class, contactId, this);
307 
308         if (contact == null) {
309             Session session = null;
310 
311             try {
312                 session = openSession();
313 
314                 contact = (Contact)session.get(ContactImpl.class,
315                         new Long(contactId));
316             }
317             catch (Exception e) {
318                 throw processException(e);
319             }
320             finally {
321                 if (contact != null) {
322                     cacheResult(contact);
323                 }
324 
325                 closeSession(session);
326             }
327         }
328 
329         return contact;
330     }
331 
332     public List<Contact> findByCompanyId(long companyId)
333         throws SystemException {
334         Object[] finderArgs = new Object[] { new Long(companyId) };
335 
336         List<Contact> list = (List<Contact>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
337                 finderArgs, this);
338 
339         if (list == null) {
340             Session session = null;
341 
342             try {
343                 session = openSession();
344 
345                 StringBundler query = new StringBundler(2);
346 
347                 query.append(_SQL_SELECT_CONTACT_WHERE);
348 
349                 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
350 
351                 String sql = query.toString();
352 
353                 Query q = session.createQuery(sql);
354 
355                 QueryPos qPos = QueryPos.getInstance(q);
356 
357                 qPos.add(companyId);
358 
359                 list = q.list();
360             }
361             catch (Exception e) {
362                 throw processException(e);
363             }
364             finally {
365                 if (list == null) {
366                     list = new ArrayList<Contact>();
367                 }
368 
369                 cacheResult(list);
370 
371                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
372                     finderArgs, list);
373 
374                 closeSession(session);
375             }
376         }
377 
378         return list;
379     }
380 
381     public List<Contact> findByCompanyId(long companyId, int start, int end)
382         throws SystemException {
383         return findByCompanyId(companyId, start, end, null);
384     }
385 
386     public List<Contact> findByCompanyId(long companyId, int start, int end,
387         OrderByComparator orderByComparator) throws SystemException {
388         Object[] finderArgs = new Object[] {
389                 new Long(companyId),
390                 
391                 String.valueOf(start), String.valueOf(end),
392                 String.valueOf(orderByComparator)
393             };
394 
395         List<Contact> list = (List<Contact>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
396                 finderArgs, this);
397 
398         if (list == null) {
399             Session session = null;
400 
401             try {
402                 session = openSession();
403 
404                 StringBundler query = null;
405 
406                 if (orderByComparator != null) {
407                     query = new StringBundler(3 +
408                             (orderByComparator.getOrderByFields().length * 3));
409                 }
410                 else {
411                     query = new StringBundler(2);
412                 }
413 
414                 query.append(_SQL_SELECT_CONTACT_WHERE);
415 
416                 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
417 
418                 if (orderByComparator != null) {
419                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
420                         orderByComparator);
421                 }
422 
423                 String sql = query.toString();
424 
425                 Query q = session.createQuery(sql);
426 
427                 QueryPos qPos = QueryPos.getInstance(q);
428 
429                 qPos.add(companyId);
430 
431                 list = (List<Contact>)QueryUtil.list(q, getDialect(), start, end);
432             }
433             catch (Exception e) {
434                 throw processException(e);
435             }
436             finally {
437                 if (list == null) {
438                     list = new ArrayList<Contact>();
439                 }
440 
441                 cacheResult(list);
442 
443                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
444                     finderArgs, list);
445 
446                 closeSession(session);
447             }
448         }
449 
450         return list;
451     }
452 
453     public Contact findByCompanyId_First(long companyId,
454         OrderByComparator orderByComparator)
455         throws NoSuchContactException, SystemException {
456         List<Contact> list = findByCompanyId(companyId, 0, 1, orderByComparator);
457 
458         if (list.isEmpty()) {
459             StringBundler msg = new StringBundler(4);
460 
461             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
462 
463             msg.append("companyId=");
464             msg.append(companyId);
465 
466             msg.append(StringPool.CLOSE_CURLY_BRACE);
467 
468             throw new NoSuchContactException(msg.toString());
469         }
470         else {
471             return list.get(0);
472         }
473     }
474 
475     public Contact findByCompanyId_Last(long companyId,
476         OrderByComparator orderByComparator)
477         throws NoSuchContactException, SystemException {
478         int count = countByCompanyId(companyId);
479 
480         List<Contact> list = findByCompanyId(companyId, count - 1, count,
481                 orderByComparator);
482 
483         if (list.isEmpty()) {
484             StringBundler msg = new StringBundler(4);
485 
486             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
487 
488             msg.append("companyId=");
489             msg.append(companyId);
490 
491             msg.append(StringPool.CLOSE_CURLY_BRACE);
492 
493             throw new NoSuchContactException(msg.toString());
494         }
495         else {
496             return list.get(0);
497         }
498     }
499 
500     public Contact[] findByCompanyId_PrevAndNext(long contactId,
501         long companyId, OrderByComparator orderByComparator)
502         throws NoSuchContactException, SystemException {
503         Contact contact = findByPrimaryKey(contactId);
504 
505         int count = countByCompanyId(companyId);
506 
507         Session session = null;
508 
509         try {
510             session = openSession();
511 
512             StringBundler query = null;
513 
514             if (orderByComparator != null) {
515                 query = new StringBundler(3 +
516                         (orderByComparator.getOrderByFields().length * 3));
517             }
518             else {
519                 query = new StringBundler(2);
520             }
521 
522             query.append(_SQL_SELECT_CONTACT_WHERE);
523 
524             query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
525 
526             if (orderByComparator != null) {
527                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
528                     orderByComparator);
529             }
530 
531             String sql = query.toString();
532 
533             Query q = session.createQuery(sql);
534 
535             QueryPos qPos = QueryPos.getInstance(q);
536 
537             qPos.add(companyId);
538 
539             Object[] objArray = QueryUtil.getPrevAndNext(q, count,
540                     orderByComparator, contact);
541 
542             Contact[] array = new ContactImpl[3];
543 
544             array[0] = (Contact)objArray[0];
545             array[1] = (Contact)objArray[1];
546             array[2] = (Contact)objArray[2];
547 
548             return array;
549         }
550         catch (Exception e) {
551             throw processException(e);
552         }
553         finally {
554             closeSession(session);
555         }
556     }
557 
558     public List<Contact> findAll() throws SystemException {
559         return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
560     }
561 
562     public List<Contact> findAll(int start, int end) throws SystemException {
563         return findAll(start, end, null);
564     }
565 
566     public List<Contact> findAll(int start, int end,
567         OrderByComparator orderByComparator) throws SystemException {
568         Object[] finderArgs = new Object[] {
569                 String.valueOf(start), String.valueOf(end),
570                 String.valueOf(orderByComparator)
571             };
572 
573         List<Contact> list = (List<Contact>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
574                 finderArgs, this);
575 
576         if (list == null) {
577             Session session = null;
578 
579             try {
580                 session = openSession();
581 
582                 StringBundler query = null;
583                 String sql = null;
584 
585                 if (orderByComparator != null) {
586                     query = new StringBundler(2 +
587                             (orderByComparator.getOrderByFields().length * 3));
588 
589                     query.append(_SQL_SELECT_CONTACT);
590 
591                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
592                         orderByComparator);
593 
594                     sql = query.toString();
595                 }
596 
597                 sql = _SQL_SELECT_CONTACT;
598 
599                 Query q = session.createQuery(sql);
600 
601                 if (orderByComparator == null) {
602                     list = (List<Contact>)QueryUtil.list(q, getDialect(),
603                             start, end, false);
604 
605                     Collections.sort(list);
606                 }
607                 else {
608                     list = (List<Contact>)QueryUtil.list(q, getDialect(),
609                             start, end);
610                 }
611             }
612             catch (Exception e) {
613                 throw processException(e);
614             }
615             finally {
616                 if (list == null) {
617                     list = new ArrayList<Contact>();
618                 }
619 
620                 cacheResult(list);
621 
622                 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
623 
624                 closeSession(session);
625             }
626         }
627 
628         return list;
629     }
630 
631     public void removeByCompanyId(long companyId) throws SystemException {
632         for (Contact contact : findByCompanyId(companyId)) {
633             remove(contact);
634         }
635     }
636 
637     public void removeAll() throws SystemException {
638         for (Contact contact : findAll()) {
639             remove(contact);
640         }
641     }
642 
643     public int countByCompanyId(long companyId) throws SystemException {
644         Object[] finderArgs = new Object[] { new Long(companyId) };
645 
646         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
647                 finderArgs, this);
648 
649         if (count == null) {
650             Session session = null;
651 
652             try {
653                 session = openSession();
654 
655                 StringBundler query = new StringBundler(2);
656 
657                 query.append(_SQL_COUNT_CONTACT_WHERE);
658 
659                 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
660 
661                 String sql = query.toString();
662 
663                 Query q = session.createQuery(sql);
664 
665                 QueryPos qPos = QueryPos.getInstance(q);
666 
667                 qPos.add(companyId);
668 
669                 count = (Long)q.uniqueResult();
670             }
671             catch (Exception e) {
672                 throw processException(e);
673             }
674             finally {
675                 if (count == null) {
676                     count = Long.valueOf(0);
677                 }
678 
679                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
680                     finderArgs, count);
681 
682                 closeSession(session);
683             }
684         }
685 
686         return count.intValue();
687     }
688 
689     public int countAll() throws SystemException {
690         Object[] finderArgs = new Object[0];
691 
692         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
693                 finderArgs, this);
694 
695         if (count == null) {
696             Session session = null;
697 
698             try {
699                 session = openSession();
700 
701                 Query q = session.createQuery(_SQL_COUNT_CONTACT);
702 
703                 count = (Long)q.uniqueResult();
704             }
705             catch (Exception e) {
706                 throw processException(e);
707             }
708             finally {
709                 if (count == null) {
710                     count = Long.valueOf(0);
711                 }
712 
713                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
714                     count);
715 
716                 closeSession(session);
717             }
718         }
719 
720         return count.intValue();
721     }
722 
723     public void afterPropertiesSet() {
724         String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
725                     com.liferay.portal.util.PropsUtil.get(
726                         "value.object.listener.com.liferay.portal.model.Contact")));
727 
728         if (listenerClassNames.length > 0) {
729             try {
730                 List<ModelListener<Contact>> listenersList = new ArrayList<ModelListener<Contact>>();
731 
732                 for (String listenerClassName : listenerClassNames) {
733                     listenersList.add((ModelListener<Contact>)Class.forName(
734                             listenerClassName).newInstance());
735                 }
736 
737                 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
738             }
739             catch (Exception e) {
740                 _log.error(e);
741             }
742         }
743     }
744 
745     @BeanReference(type = AccountPersistence.class)
746     protected AccountPersistence accountPersistence;
747     @BeanReference(type = AddressPersistence.class)
748     protected AddressPersistence addressPersistence;
749     @BeanReference(type = BrowserTrackerPersistence.class)
750     protected BrowserTrackerPersistence browserTrackerPersistence;
751     @BeanReference(type = ClassNamePersistence.class)
752     protected ClassNamePersistence classNamePersistence;
753     @BeanReference(type = CompanyPersistence.class)
754     protected CompanyPersistence companyPersistence;
755     @BeanReference(type = ContactPersistence.class)
756     protected ContactPersistence contactPersistence;
757     @BeanReference(type = CountryPersistence.class)
758     protected CountryPersistence countryPersistence;
759     @BeanReference(type = EmailAddressPersistence.class)
760     protected EmailAddressPersistence emailAddressPersistence;
761     @BeanReference(type = GroupPersistence.class)
762     protected GroupPersistence groupPersistence;
763     @BeanReference(type = ImagePersistence.class)
764     protected ImagePersistence imagePersistence;
765     @BeanReference(type = LayoutPersistence.class)
766     protected LayoutPersistence layoutPersistence;
767     @BeanReference(type = LayoutPrototypePersistence.class)
768     protected LayoutPrototypePersistence layoutPrototypePersistence;
769     @BeanReference(type = LayoutSetPersistence.class)
770     protected LayoutSetPersistence layoutSetPersistence;
771     @BeanReference(type = LayoutSetPrototypePersistence.class)
772     protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
773     @BeanReference(type = ListTypePersistence.class)
774     protected ListTypePersistence listTypePersistence;
775     @BeanReference(type = LockPersistence.class)
776     protected LockPersistence lockPersistence;
777     @BeanReference(type = MembershipRequestPersistence.class)
778     protected MembershipRequestPersistence membershipRequestPersistence;
779     @BeanReference(type = OrganizationPersistence.class)
780     protected OrganizationPersistence organizationPersistence;
781     @BeanReference(type = OrgGroupPermissionPersistence.class)
782     protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
783     @BeanReference(type = OrgGroupRolePersistence.class)
784     protected OrgGroupRolePersistence orgGroupRolePersistence;
785     @BeanReference(type = OrgLaborPersistence.class)
786     protected OrgLaborPersistence orgLaborPersistence;
787     @BeanReference(type = PasswordPolicyPersistence.class)
788     protected PasswordPolicyPersistence passwordPolicyPersistence;
789     @BeanReference(type = PasswordPolicyRelPersistence.class)
790     protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
791     @BeanReference(type = PasswordTrackerPersistence.class)
792     protected PasswordTrackerPersistence passwordTrackerPersistence;
793     @BeanReference(type = PermissionPersistence.class)
794     protected PermissionPersistence permissionPersistence;
795     @BeanReference(type = PhonePersistence.class)
796     protected PhonePersistence phonePersistence;
797     @BeanReference(type = PluginSettingPersistence.class)
798     protected PluginSettingPersistence pluginSettingPersistence;
799     @BeanReference(type = PortletPersistence.class)
800     protected PortletPersistence portletPersistence;
801     @BeanReference(type = PortletItemPersistence.class)
802     protected PortletItemPersistence portletItemPersistence;
803     @BeanReference(type = PortletPreferencesPersistence.class)
804     protected PortletPreferencesPersistence portletPreferencesPersistence;
805     @BeanReference(type = RegionPersistence.class)
806     protected RegionPersistence regionPersistence;
807     @BeanReference(type = ReleasePersistence.class)
808     protected ReleasePersistence releasePersistence;
809     @BeanReference(type = ResourcePersistence.class)
810     protected ResourcePersistence resourcePersistence;
811     @BeanReference(type = ResourceActionPersistence.class)
812     protected ResourceActionPersistence resourceActionPersistence;
813     @BeanReference(type = ResourceCodePersistence.class)
814     protected ResourceCodePersistence resourceCodePersistence;
815     @BeanReference(type = ResourcePermissionPersistence.class)
816     protected ResourcePermissionPersistence resourcePermissionPersistence;
817     @BeanReference(type = RolePersistence.class)
818     protected RolePersistence rolePersistence;
819     @BeanReference(type = ServiceComponentPersistence.class)
820     protected ServiceComponentPersistence serviceComponentPersistence;
821     @BeanReference(type = ShardPersistence.class)
822     protected ShardPersistence shardPersistence;
823     @BeanReference(type = SubscriptionPersistence.class)
824     protected SubscriptionPersistence subscriptionPersistence;
825     @BeanReference(type = TeamPersistence.class)
826     protected TeamPersistence teamPersistence;
827     @BeanReference(type = UserPersistence.class)
828     protected UserPersistence userPersistence;
829     @BeanReference(type = UserGroupPersistence.class)
830     protected UserGroupPersistence userGroupPersistence;
831     @BeanReference(type = UserGroupGroupRolePersistence.class)
832     protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
833     @BeanReference(type = UserGroupRolePersistence.class)
834     protected UserGroupRolePersistence userGroupRolePersistence;
835     @BeanReference(type = UserIdMapperPersistence.class)
836     protected UserIdMapperPersistence userIdMapperPersistence;
837     @BeanReference(type = UserTrackerPersistence.class)
838     protected UserTrackerPersistence userTrackerPersistence;
839     @BeanReference(type = UserTrackerPathPersistence.class)
840     protected UserTrackerPathPersistence userTrackerPathPersistence;
841     @BeanReference(type = WebDAVPropsPersistence.class)
842     protected WebDAVPropsPersistence webDAVPropsPersistence;
843     @BeanReference(type = WebsitePersistence.class)
844     protected WebsitePersistence websitePersistence;
845     @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
846     protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
847     @BeanReference(type = WorkflowInstanceLinkPersistence.class)
848     protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
849     private static final String _SQL_SELECT_CONTACT = "SELECT contact FROM Contact contact";
850     private static final String _SQL_SELECT_CONTACT_WHERE = "SELECT contact FROM Contact contact WHERE ";
851     private static final String _SQL_COUNT_CONTACT = "SELECT COUNT(contact) FROM Contact contact";
852     private static final String _SQL_COUNT_CONTACT_WHERE = "SELECT COUNT(contact) FROM Contact contact WHERE ";
853     private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "contact.companyId = ?";
854     private static final String _ORDER_BY_ENTITY_ALIAS = "contact.";
855     private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Contact exists with the primary key ";
856     private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Contact exists with the key {";
857     private static Log _log = LogFactoryUtil.getLog(ContactPersistenceImpl.class);
858 }