1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portlet.polls.service.persistence;
16  
17  import com.liferay.portal.NoSuchModelException;
18  import com.liferay.portal.SystemException;
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.log.Log;
29  import com.liferay.portal.kernel.log.LogFactoryUtil;
30  import com.liferay.portal.kernel.util.GetterUtil;
31  import com.liferay.portal.kernel.util.InstanceFactory;
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.kernel.util.Validator;
37  import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
38  import com.liferay.portal.model.ModelListener;
39  import com.liferay.portal.service.persistence.BatchSessionUtil;
40  import com.liferay.portal.service.persistence.ResourcePersistence;
41  import com.liferay.portal.service.persistence.UserPersistence;
42  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
43  
44  import com.liferay.portlet.polls.NoSuchQuestionException;
45  import com.liferay.portlet.polls.model.PollsQuestion;
46  import com.liferay.portlet.polls.model.impl.PollsQuestionImpl;
47  import com.liferay.portlet.polls.model.impl.PollsQuestionModelImpl;
48  
49  import java.io.Serializable;
50  
51  import java.util.ArrayList;
52  import java.util.Collections;
53  import java.util.List;
54  
55  /**
56   * <a href="PollsQuestionPersistenceImpl.java.html"><b><i>View Source</i></b></a>
57   *
58   * <p>
59   * ServiceBuilder generated this class. Modifications in this class will be
60   * overwritten the next time is generated.
61   * </p>
62   *
63   * @author    Brian Wing Shun Chan
64   * @see       PollsQuestionPersistence
65   * @see       PollsQuestionUtil
66   * @generated
67   */
68  public class PollsQuestionPersistenceImpl extends BasePersistenceImpl<PollsQuestion>
69      implements PollsQuestionPersistence {
70      public static final String FINDER_CLASS_NAME_ENTITY = PollsQuestionImpl.class.getName();
71      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
72          ".List";
73      public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
74              PollsQuestionModelImpl.FINDER_CACHE_ENABLED,
75              FINDER_CLASS_NAME_LIST, "findByUuid",
76              new String[] {
77                  String.class.getName(),
78                  
79              "java.lang.Integer", "java.lang.Integer",
80                  "com.liferay.portal.kernel.util.OrderByComparator"
81              });
82      public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
83              PollsQuestionModelImpl.FINDER_CACHE_ENABLED,
84              FINDER_CLASS_NAME_LIST, "countByUuid",
85              new String[] { String.class.getName() });
86      public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
87              PollsQuestionModelImpl.FINDER_CACHE_ENABLED,
88              FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G",
89              new String[] { String.class.getName(), Long.class.getName() });
90      public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
91              PollsQuestionModelImpl.FINDER_CACHE_ENABLED,
92              FINDER_CLASS_NAME_LIST, "countByUUID_G",
93              new String[] { String.class.getName(), Long.class.getName() });
94      public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
95              PollsQuestionModelImpl.FINDER_CACHE_ENABLED,
96              FINDER_CLASS_NAME_LIST, "findByGroupId",
97              new String[] {
98                  Long.class.getName(),
99                  
100             "java.lang.Integer", "java.lang.Integer",
101                 "com.liferay.portal.kernel.util.OrderByComparator"
102             });
103     public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
104             PollsQuestionModelImpl.FINDER_CACHE_ENABLED,
105             FINDER_CLASS_NAME_LIST, "countByGroupId",
106             new String[] { Long.class.getName() });
107     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
108             PollsQuestionModelImpl.FINDER_CACHE_ENABLED,
109             FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
110     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
111             PollsQuestionModelImpl.FINDER_CACHE_ENABLED,
112             FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
113 
114     public void cacheResult(PollsQuestion pollsQuestion) {
115         EntityCacheUtil.putResult(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
116             PollsQuestionImpl.class, pollsQuestion.getPrimaryKey(),
117             pollsQuestion);
118 
119         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
120             new Object[] {
121                 pollsQuestion.getUuid(), new Long(pollsQuestion.getGroupId())
122             }, pollsQuestion);
123     }
124 
125     public void cacheResult(List<PollsQuestion> pollsQuestions) {
126         for (PollsQuestion pollsQuestion : pollsQuestions) {
127             if (EntityCacheUtil.getResult(
128                         PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
129                         PollsQuestionImpl.class, pollsQuestion.getPrimaryKey(),
130                         this) == null) {
131                 cacheResult(pollsQuestion);
132             }
133         }
134     }
135 
136     public void clearCache() {
137         CacheRegistry.clear(PollsQuestionImpl.class.getName());
138         EntityCacheUtil.clearCache(PollsQuestionImpl.class.getName());
139         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
140         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
141     }
142 
143     public void clearCache(PollsQuestion pollsQuestion) {
144         EntityCacheUtil.removeResult(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
145             PollsQuestionImpl.class, pollsQuestion.getPrimaryKey());
146 
147         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
148             new Object[] {
149                 pollsQuestion.getUuid(), new Long(pollsQuestion.getGroupId())
150             });
151     }
152 
153     public PollsQuestion create(long questionId) {
154         PollsQuestion pollsQuestion = new PollsQuestionImpl();
155 
156         pollsQuestion.setNew(true);
157         pollsQuestion.setPrimaryKey(questionId);
158 
159         String uuid = PortalUUIDUtil.generate();
160 
161         pollsQuestion.setUuid(uuid);
162 
163         return pollsQuestion;
164     }
165 
166     public PollsQuestion remove(Serializable primaryKey)
167         throws NoSuchModelException, SystemException {
168         return remove(((Long)primaryKey).longValue());
169     }
170 
171     public PollsQuestion remove(long questionId)
172         throws NoSuchQuestionException, SystemException {
173         Session session = null;
174 
175         try {
176             session = openSession();
177 
178             PollsQuestion pollsQuestion = (PollsQuestion)session.get(PollsQuestionImpl.class,
179                     new Long(questionId));
180 
181             if (pollsQuestion == null) {
182                 if (_log.isWarnEnabled()) {
183                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + questionId);
184                 }
185 
186                 throw new NoSuchQuestionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
187                     questionId);
188             }
189 
190             return remove(pollsQuestion);
191         }
192         catch (NoSuchQuestionException nsee) {
193             throw nsee;
194         }
195         catch (Exception e) {
196             throw processException(e);
197         }
198         finally {
199             closeSession(session);
200         }
201     }
202 
203     protected PollsQuestion removeImpl(PollsQuestion pollsQuestion)
204         throws SystemException {
205         pollsQuestion = toUnwrappedModel(pollsQuestion);
206 
207         Session session = null;
208 
209         try {
210             session = openSession();
211 
212             BatchSessionUtil.delete(session, pollsQuestion);
213         }
214         catch (Exception e) {
215             throw processException(e);
216         }
217         finally {
218             closeSession(session);
219         }
220 
221         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
222 
223         PollsQuestionModelImpl pollsQuestionModelImpl = (PollsQuestionModelImpl)pollsQuestion;
224 
225         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
226             new Object[] {
227                 pollsQuestionModelImpl.getOriginalUuid(),
228                 new Long(pollsQuestionModelImpl.getOriginalGroupId())
229             });
230 
231         EntityCacheUtil.removeResult(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
232             PollsQuestionImpl.class, pollsQuestion.getPrimaryKey());
233 
234         return pollsQuestion;
235     }
236 
237     /**
238      * @deprecated Use {@link BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)}.
239      */
240     public PollsQuestion update(PollsQuestion pollsQuestion)
241         throws SystemException {
242         if (_log.isWarnEnabled()) {
243             _log.warn(
244                 "Using the deprecated update(PollsQuestion pollsQuestion) method. Use update(PollsQuestion pollsQuestion, boolean merge) instead.");
245         }
246 
247         return update(pollsQuestion, false);
248     }
249 
250     public PollsQuestion updateImpl(
251         com.liferay.portlet.polls.model.PollsQuestion pollsQuestion,
252         boolean merge) throws SystemException {
253         pollsQuestion = toUnwrappedModel(pollsQuestion);
254 
255         boolean isNew = pollsQuestion.isNew();
256 
257         PollsQuestionModelImpl pollsQuestionModelImpl = (PollsQuestionModelImpl)pollsQuestion;
258 
259         if (Validator.isNull(pollsQuestion.getUuid())) {
260             String uuid = PortalUUIDUtil.generate();
261 
262             pollsQuestion.setUuid(uuid);
263         }
264 
265         Session session = null;
266 
267         try {
268             session = openSession();
269 
270             BatchSessionUtil.update(session, pollsQuestion, merge);
271 
272             pollsQuestion.setNew(false);
273         }
274         catch (Exception e) {
275             throw processException(e);
276         }
277         finally {
278             closeSession(session);
279         }
280 
281         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
282 
283         EntityCacheUtil.putResult(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
284             PollsQuestionImpl.class, pollsQuestion.getPrimaryKey(),
285             pollsQuestion);
286 
287         if (!isNew &&
288                 (!Validator.equals(pollsQuestion.getUuid(),
289                     pollsQuestionModelImpl.getOriginalUuid()) ||
290                 (pollsQuestion.getGroupId() != pollsQuestionModelImpl.getOriginalGroupId()))) {
291             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
292                 new Object[] {
293                     pollsQuestionModelImpl.getOriginalUuid(),
294                     new Long(pollsQuestionModelImpl.getOriginalGroupId())
295                 });
296         }
297 
298         if (isNew ||
299                 (!Validator.equals(pollsQuestion.getUuid(),
300                     pollsQuestionModelImpl.getOriginalUuid()) ||
301                 (pollsQuestion.getGroupId() != pollsQuestionModelImpl.getOriginalGroupId()))) {
302             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
303                 new Object[] {
304                     pollsQuestion.getUuid(),
305                     new Long(pollsQuestion.getGroupId())
306                 }, pollsQuestion);
307         }
308 
309         return pollsQuestion;
310     }
311 
312     protected PollsQuestion toUnwrappedModel(PollsQuestion pollsQuestion) {
313         if (pollsQuestion instanceof PollsQuestionImpl) {
314             return pollsQuestion;
315         }
316 
317         PollsQuestionImpl pollsQuestionImpl = new PollsQuestionImpl();
318 
319         pollsQuestionImpl.setNew(pollsQuestion.isNew());
320         pollsQuestionImpl.setPrimaryKey(pollsQuestion.getPrimaryKey());
321 
322         pollsQuestionImpl.setUuid(pollsQuestion.getUuid());
323         pollsQuestionImpl.setQuestionId(pollsQuestion.getQuestionId());
324         pollsQuestionImpl.setGroupId(pollsQuestion.getGroupId());
325         pollsQuestionImpl.setCompanyId(pollsQuestion.getCompanyId());
326         pollsQuestionImpl.setUserId(pollsQuestion.getUserId());
327         pollsQuestionImpl.setUserName(pollsQuestion.getUserName());
328         pollsQuestionImpl.setCreateDate(pollsQuestion.getCreateDate());
329         pollsQuestionImpl.setModifiedDate(pollsQuestion.getModifiedDate());
330         pollsQuestionImpl.setTitle(pollsQuestion.getTitle());
331         pollsQuestionImpl.setDescription(pollsQuestion.getDescription());
332         pollsQuestionImpl.setExpirationDate(pollsQuestion.getExpirationDate());
333         pollsQuestionImpl.setLastVoteDate(pollsQuestion.getLastVoteDate());
334 
335         return pollsQuestionImpl;
336     }
337 
338     public PollsQuestion findByPrimaryKey(Serializable primaryKey)
339         throws NoSuchModelException, SystemException {
340         return findByPrimaryKey(((Long)primaryKey).longValue());
341     }
342 
343     public PollsQuestion findByPrimaryKey(long questionId)
344         throws NoSuchQuestionException, SystemException {
345         PollsQuestion pollsQuestion = fetchByPrimaryKey(questionId);
346 
347         if (pollsQuestion == null) {
348             if (_log.isWarnEnabled()) {
349                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + questionId);
350             }
351 
352             throw new NoSuchQuestionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
353                 questionId);
354         }
355 
356         return pollsQuestion;
357     }
358 
359     public PollsQuestion fetchByPrimaryKey(Serializable primaryKey)
360         throws SystemException {
361         return fetchByPrimaryKey(((Long)primaryKey).longValue());
362     }
363 
364     public PollsQuestion fetchByPrimaryKey(long questionId)
365         throws SystemException {
366         PollsQuestion pollsQuestion = (PollsQuestion)EntityCacheUtil.getResult(PollsQuestionModelImpl.ENTITY_CACHE_ENABLED,
367                 PollsQuestionImpl.class, questionId, this);
368 
369         if (pollsQuestion == null) {
370             Session session = null;
371 
372             try {
373                 session = openSession();
374 
375                 pollsQuestion = (PollsQuestion)session.get(PollsQuestionImpl.class,
376                         new Long(questionId));
377             }
378             catch (Exception e) {
379                 throw processException(e);
380             }
381             finally {
382                 if (pollsQuestion != null) {
383                     cacheResult(pollsQuestion);
384                 }
385 
386                 closeSession(session);
387             }
388         }
389 
390         return pollsQuestion;
391     }
392 
393     public List<PollsQuestion> findByUuid(String uuid)
394         throws SystemException {
395         return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
396     }
397 
398     public List<PollsQuestion> findByUuid(String uuid, int start, int end)
399         throws SystemException {
400         return findByUuid(uuid, start, end, null);
401     }
402 
403     public List<PollsQuestion> findByUuid(String uuid, int start, int end,
404         OrderByComparator orderByComparator) throws SystemException {
405         Object[] finderArgs = new Object[] {
406                 uuid,
407                 
408                 String.valueOf(start), String.valueOf(end),
409                 String.valueOf(orderByComparator)
410             };
411 
412         List<PollsQuestion> list = (List<PollsQuestion>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
413                 finderArgs, this);
414 
415         if (list == null) {
416             StringBundler query = null;
417 
418             if (orderByComparator != null) {
419                 query = new StringBundler(3 +
420                         (orderByComparator.getOrderByFields().length * 3));
421             }
422             else {
423                 query = new StringBundler(3);
424             }
425 
426             query.append(_SQL_SELECT_POLLSQUESTION_WHERE);
427 
428             if (uuid == null) {
429                 query.append(_FINDER_COLUMN_UUID_UUID_1);
430             }
431             else {
432                 if (uuid.equals(StringPool.BLANK)) {
433                     query.append(_FINDER_COLUMN_UUID_UUID_3);
434                 }
435                 else {
436                     query.append(_FINDER_COLUMN_UUID_UUID_2);
437                 }
438             }
439 
440             if (orderByComparator != null) {
441                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
442                     orderByComparator);
443             }
444 
445             else {
446                 query.append(PollsQuestionModelImpl.ORDER_BY_JPQL);
447             }
448 
449             String sql = query.toString();
450 
451             Session session = null;
452 
453             try {
454                 session = openSession();
455 
456                 Query q = session.createQuery(sql);
457 
458                 QueryPos qPos = QueryPos.getInstance(q);
459 
460                 if (uuid != null) {
461                     qPos.add(uuid);
462                 }
463 
464                 list = (List<PollsQuestion>)QueryUtil.list(q, getDialect(),
465                         start, end);
466             }
467             catch (Exception e) {
468                 throw processException(e);
469             }
470             finally {
471                 if (list == null) {
472                     list = new ArrayList<PollsQuestion>();
473                 }
474 
475                 cacheResult(list);
476 
477                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
478                     list);
479 
480                 closeSession(session);
481             }
482         }
483 
484         return list;
485     }
486 
487     public PollsQuestion findByUuid_First(String uuid,
488         OrderByComparator orderByComparator)
489         throws NoSuchQuestionException, SystemException {
490         List<PollsQuestion> list = findByUuid(uuid, 0, 1, orderByComparator);
491 
492         if (list.isEmpty()) {
493             StringBundler msg = new StringBundler(4);
494 
495             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
496 
497             msg.append("uuid=");
498             msg.append(uuid);
499 
500             msg.append(StringPool.CLOSE_CURLY_BRACE);
501 
502             throw new NoSuchQuestionException(msg.toString());
503         }
504         else {
505             return list.get(0);
506         }
507     }
508 
509     public PollsQuestion findByUuid_Last(String uuid,
510         OrderByComparator orderByComparator)
511         throws NoSuchQuestionException, SystemException {
512         int count = countByUuid(uuid);
513 
514         List<PollsQuestion> list = findByUuid(uuid, count - 1, count,
515                 orderByComparator);
516 
517         if (list.isEmpty()) {
518             StringBundler msg = new StringBundler(4);
519 
520             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
521 
522             msg.append("uuid=");
523             msg.append(uuid);
524 
525             msg.append(StringPool.CLOSE_CURLY_BRACE);
526 
527             throw new NoSuchQuestionException(msg.toString());
528         }
529         else {
530             return list.get(0);
531         }
532     }
533 
534     public PollsQuestion[] findByUuid_PrevAndNext(long questionId, String uuid,
535         OrderByComparator orderByComparator)
536         throws NoSuchQuestionException, SystemException {
537         PollsQuestion pollsQuestion = findByPrimaryKey(questionId);
538 
539         Session session = null;
540 
541         try {
542             session = openSession();
543 
544             PollsQuestion[] array = new PollsQuestionImpl[3];
545 
546             array[0] = getByUuid_PrevAndNext(session, pollsQuestion, uuid,
547                     orderByComparator, true);
548 
549             array[1] = pollsQuestion;
550 
551             array[2] = getByUuid_PrevAndNext(session, pollsQuestion, uuid,
552                     orderByComparator, false);
553 
554             return array;
555         }
556         catch (Exception e) {
557             throw processException(e);
558         }
559         finally {
560             closeSession(session);
561         }
562     }
563 
564     protected PollsQuestion getByUuid_PrevAndNext(Session session,
565         PollsQuestion pollsQuestion, String uuid,
566         OrderByComparator orderByComparator, boolean previous) {
567         StringBundler query = null;
568 
569         if (orderByComparator != null) {
570             query = new StringBundler(6 +
571                     (orderByComparator.getOrderByFields().length * 6));
572         }
573         else {
574             query = new StringBundler(3);
575         }
576 
577         query.append(_SQL_SELECT_POLLSQUESTION_WHERE);
578 
579         if (uuid == null) {
580             query.append(_FINDER_COLUMN_UUID_UUID_1);
581         }
582         else {
583             if (uuid.equals(StringPool.BLANK)) {
584                 query.append(_FINDER_COLUMN_UUID_UUID_3);
585             }
586             else {
587                 query.append(_FINDER_COLUMN_UUID_UUID_2);
588             }
589         }
590 
591         if (orderByComparator != null) {
592             String[] orderByFields = orderByComparator.getOrderByFields();
593 
594             if (orderByFields.length > 0) {
595                 query.append(WHERE_AND);
596             }
597 
598             for (int i = 0; i < orderByFields.length; i++) {
599                 query.append(_ORDER_BY_ENTITY_ALIAS);
600                 query.append(orderByFields[i]);
601 
602                 if ((i + 1) < orderByFields.length) {
603                     if (orderByComparator.isAscending() ^ previous) {
604                         query.append(WHERE_GREATER_THAN_HAS_NEXT);
605                     }
606                     else {
607                         query.append(WHERE_LESSER_THAN_HAS_NEXT);
608                     }
609                 }
610                 else {
611                     if (orderByComparator.isAscending() ^ previous) {
612                         query.append(WHERE_GREATER_THAN);
613                     }
614                     else {
615                         query.append(WHERE_LESSER_THAN);
616                     }
617                 }
618             }
619 
620             query.append(ORDER_BY_CLAUSE);
621 
622             for (int i = 0; i < orderByFields.length; i++) {
623                 query.append(_ORDER_BY_ENTITY_ALIAS);
624                 query.append(orderByFields[i]);
625 
626                 if ((i + 1) < orderByFields.length) {
627                     if (orderByComparator.isAscending() ^ previous) {
628                         query.append(ORDER_BY_ASC_HAS_NEXT);
629                     }
630                     else {
631                         query.append(ORDER_BY_DESC_HAS_NEXT);
632                     }
633                 }
634                 else {
635                     if (orderByComparator.isAscending() ^ previous) {
636                         query.append(ORDER_BY_ASC);
637                     }
638                     else {
639                         query.append(ORDER_BY_DESC);
640                     }
641                 }
642             }
643         }
644 
645         else {
646             query.append(PollsQuestionModelImpl.ORDER_BY_JPQL);
647         }
648 
649         String sql = query.toString();
650 
651         Query q = session.createQuery(sql);
652 
653         q.setFirstResult(0);
654         q.setMaxResults(2);
655 
656         QueryPos qPos = QueryPos.getInstance(q);
657 
658         if (uuid != null) {
659             qPos.add(uuid);
660         }
661 
662         if (orderByComparator != null) {
663             Object[] values = orderByComparator.getOrderByValues(pollsQuestion);
664 
665             for (Object value : values) {
666                 qPos.add(value);
667             }
668         }
669 
670         List<PollsQuestion> list = q.list();
671 
672         if (list.size() == 2) {
673             return list.get(1);
674         }
675         else {
676             return null;
677         }
678     }
679 
680     public PollsQuestion findByUUID_G(String uuid, long groupId)
681         throws NoSuchQuestionException, SystemException {
682         PollsQuestion pollsQuestion = fetchByUUID_G(uuid, groupId);
683 
684         if (pollsQuestion == null) {
685             StringBundler msg = new StringBundler(6);
686 
687             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
688 
689             msg.append("uuid=");
690             msg.append(uuid);
691 
692             msg.append(", groupId=");
693             msg.append(groupId);
694 
695             msg.append(StringPool.CLOSE_CURLY_BRACE);
696 
697             if (_log.isWarnEnabled()) {
698                 _log.warn(msg.toString());
699             }
700 
701             throw new NoSuchQuestionException(msg.toString());
702         }
703 
704         return pollsQuestion;
705     }
706 
707     public PollsQuestion fetchByUUID_G(String uuid, long groupId)
708         throws SystemException {
709         return fetchByUUID_G(uuid, groupId, true);
710     }
711 
712     public PollsQuestion fetchByUUID_G(String uuid, long groupId,
713         boolean retrieveFromCache) throws SystemException {
714         Object[] finderArgs = new Object[] { uuid, groupId };
715 
716         Object result = null;
717 
718         if (retrieveFromCache) {
719             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
720                     finderArgs, this);
721         }
722 
723         if (result == null) {
724             StringBundler query = new StringBundler(4);
725 
726             query.append(_SQL_SELECT_POLLSQUESTION_WHERE);
727 
728             if (uuid == null) {
729                 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
730             }
731             else {
732                 if (uuid.equals(StringPool.BLANK)) {
733                     query.append(_FINDER_COLUMN_UUID_G_UUID_3);
734                 }
735                 else {
736                     query.append(_FINDER_COLUMN_UUID_G_UUID_2);
737                 }
738             }
739 
740             query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
741 
742             query.append(PollsQuestionModelImpl.ORDER_BY_JPQL);
743 
744             String sql = query.toString();
745 
746             Session session = null;
747 
748             try {
749                 session = openSession();
750 
751                 Query q = session.createQuery(sql);
752 
753                 QueryPos qPos = QueryPos.getInstance(q);
754 
755                 if (uuid != null) {
756                     qPos.add(uuid);
757                 }
758 
759                 qPos.add(groupId);
760 
761                 List<PollsQuestion> list = q.list();
762 
763                 result = list;
764 
765                 PollsQuestion pollsQuestion = null;
766 
767                 if (list.isEmpty()) {
768                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
769                         finderArgs, list);
770                 }
771                 else {
772                     pollsQuestion = list.get(0);
773 
774                     cacheResult(pollsQuestion);
775 
776                     if ((pollsQuestion.getUuid() == null) ||
777                             !pollsQuestion.getUuid().equals(uuid) ||
778                             (pollsQuestion.getGroupId() != groupId)) {
779                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
780                             finderArgs, pollsQuestion);
781                     }
782                 }
783 
784                 return pollsQuestion;
785             }
786             catch (Exception e) {
787                 throw processException(e);
788             }
789             finally {
790                 if (result == null) {
791                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
792                         finderArgs, new ArrayList<PollsQuestion>());
793                 }
794 
795                 closeSession(session);
796             }
797         }
798         else {
799             if (result instanceof List<?>) {
800                 return null;
801             }
802             else {
803                 return (PollsQuestion)result;
804             }
805         }
806     }
807 
808     public List<PollsQuestion> findByGroupId(long groupId)
809         throws SystemException {
810         return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
811     }
812 
813     public List<PollsQuestion> findByGroupId(long groupId, int start, int end)
814         throws SystemException {
815         return findByGroupId(groupId, start, end, null);
816     }
817 
818     public List<PollsQuestion> findByGroupId(long groupId, int start, int end,
819         OrderByComparator orderByComparator) throws SystemException {
820         Object[] finderArgs = new Object[] {
821                 groupId,
822                 
823                 String.valueOf(start), String.valueOf(end),
824                 String.valueOf(orderByComparator)
825             };
826 
827         List<PollsQuestion> list = (List<PollsQuestion>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
828                 finderArgs, this);
829 
830         if (list == null) {
831             StringBundler query = null;
832 
833             if (orderByComparator != null) {
834                 query = new StringBundler(3 +
835                         (orderByComparator.getOrderByFields().length * 3));
836             }
837             else {
838                 query = new StringBundler(3);
839             }
840 
841             query.append(_SQL_SELECT_POLLSQUESTION_WHERE);
842 
843             query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
844 
845             if (orderByComparator != null) {
846                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
847                     orderByComparator);
848             }
849 
850             else {
851                 query.append(PollsQuestionModelImpl.ORDER_BY_JPQL);
852             }
853 
854             String sql = query.toString();
855 
856             Session session = null;
857 
858             try {
859                 session = openSession();
860 
861                 Query q = session.createQuery(sql);
862 
863                 QueryPos qPos = QueryPos.getInstance(q);
864 
865                 qPos.add(groupId);
866 
867                 list = (List<PollsQuestion>)QueryUtil.list(q, getDialect(),
868                         start, end);
869             }
870             catch (Exception e) {
871                 throw processException(e);
872             }
873             finally {
874                 if (list == null) {
875                     list = new ArrayList<PollsQuestion>();
876                 }
877 
878                 cacheResult(list);
879 
880                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
881                     finderArgs, list);
882 
883                 closeSession(session);
884             }
885         }
886 
887         return list;
888     }
889 
890     public PollsQuestion findByGroupId_First(long groupId,
891         OrderByComparator orderByComparator)
892         throws NoSuchQuestionException, SystemException {
893         List<PollsQuestion> list = findByGroupId(groupId, 0, 1,
894                 orderByComparator);
895 
896         if (list.isEmpty()) {
897             StringBundler msg = new StringBundler(4);
898 
899             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
900 
901             msg.append("groupId=");
902             msg.append(groupId);
903 
904             msg.append(StringPool.CLOSE_CURLY_BRACE);
905 
906             throw new NoSuchQuestionException(msg.toString());
907         }
908         else {
909             return list.get(0);
910         }
911     }
912 
913     public PollsQuestion findByGroupId_Last(long groupId,
914         OrderByComparator orderByComparator)
915         throws NoSuchQuestionException, SystemException {
916         int count = countByGroupId(groupId);
917 
918         List<PollsQuestion> list = findByGroupId(groupId, count - 1, count,
919                 orderByComparator);
920 
921         if (list.isEmpty()) {
922             StringBundler msg = new StringBundler(4);
923 
924             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
925 
926             msg.append("groupId=");
927             msg.append(groupId);
928 
929             msg.append(StringPool.CLOSE_CURLY_BRACE);
930 
931             throw new NoSuchQuestionException(msg.toString());
932         }
933         else {
934             return list.get(0);
935         }
936     }
937 
938     public PollsQuestion[] findByGroupId_PrevAndNext(long questionId,
939         long groupId, OrderByComparator orderByComparator)
940         throws NoSuchQuestionException, SystemException {
941         PollsQuestion pollsQuestion = findByPrimaryKey(questionId);
942 
943         Session session = null;
944 
945         try {
946             session = openSession();
947 
948             PollsQuestion[] array = new PollsQuestionImpl[3];
949 
950             array[0] = getByGroupId_PrevAndNext(session, pollsQuestion,
951                     groupId, orderByComparator, true);
952 
953             array[1] = pollsQuestion;
954 
955             array[2] = getByGroupId_PrevAndNext(session, pollsQuestion,
956                     groupId, orderByComparator, false);
957 
958             return array;
959         }
960         catch (Exception e) {
961             throw processException(e);
962         }
963         finally {
964             closeSession(session);
965         }
966     }
967 
968     protected PollsQuestion getByGroupId_PrevAndNext(Session session,
969         PollsQuestion pollsQuestion, long groupId,
970         OrderByComparator orderByComparator, boolean previous) {
971         StringBundler query = null;
972 
973         if (orderByComparator != null) {
974             query = new StringBundler(6 +
975                     (orderByComparator.getOrderByFields().length * 6));
976         }
977         else {
978             query = new StringBundler(3);
979         }
980 
981         query.append(_SQL_SELECT_POLLSQUESTION_WHERE);
982 
983         query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
984 
985         if (orderByComparator != null) {
986             String[] orderByFields = orderByComparator.getOrderByFields();
987 
988             if (orderByFields.length > 0) {
989                 query.append(WHERE_AND);
990             }
991 
992             for (int i = 0; i < orderByFields.length; i++) {
993                 query.append(_ORDER_BY_ENTITY_ALIAS);
994                 query.append(orderByFields[i]);
995 
996                 if ((i + 1) < orderByFields.length) {
997                     if (orderByComparator.isAscending() ^ previous) {
998                         query.append(WHERE_GREATER_THAN_HAS_NEXT);
999                     }
1000                    else {
1001                        query.append(WHERE_LESSER_THAN_HAS_NEXT);
1002                    }
1003                }
1004                else {
1005                    if (orderByComparator.isAscending() ^ previous) {
1006                        query.append(WHERE_GREATER_THAN);
1007                    }
1008                    else {
1009                        query.append(WHERE_LESSER_THAN);
1010                    }
1011                }
1012            }
1013
1014            query.append(ORDER_BY_CLAUSE);
1015
1016            for (int i = 0; i < orderByFields.length; i++) {
1017                query.append(_ORDER_BY_ENTITY_ALIAS);
1018                query.append(orderByFields[i]);
1019
1020                if ((i + 1) < orderByFields.length) {
1021                    if (orderByComparator.isAscending() ^ previous) {
1022                        query.append(ORDER_BY_ASC_HAS_NEXT);
1023                    }
1024                    else {
1025                        query.append(ORDER_BY_DESC_HAS_NEXT);
1026                    }
1027                }
1028                else {
1029                    if (orderByComparator.isAscending() ^ previous) {
1030                        query.append(ORDER_BY_ASC);
1031                    }
1032                    else {
1033                        query.append(ORDER_BY_DESC);
1034                    }
1035                }
1036            }
1037        }
1038
1039        else {
1040            query.append(PollsQuestionModelImpl.ORDER_BY_JPQL);
1041        }
1042
1043        String sql = query.toString();
1044
1045        Query q = session.createQuery(sql);
1046
1047        q.setFirstResult(0);
1048        q.setMaxResults(2);
1049
1050        QueryPos qPos = QueryPos.getInstance(q);
1051
1052        qPos.add(groupId);
1053
1054        if (orderByComparator != null) {
1055            Object[] values = orderByComparator.getOrderByValues(pollsQuestion);
1056
1057            for (Object value : values) {
1058                qPos.add(value);
1059            }
1060        }
1061
1062        List<PollsQuestion> list = q.list();
1063
1064        if (list.size() == 2) {
1065            return list.get(1);
1066        }
1067        else {
1068            return null;
1069        }
1070    }
1071
1072    public List<PollsQuestion> findAll() throws SystemException {
1073        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1074    }
1075
1076    public List<PollsQuestion> findAll(int start, int end)
1077        throws SystemException {
1078        return findAll(start, end, null);
1079    }
1080
1081    public List<PollsQuestion> findAll(int start, int end,
1082        OrderByComparator orderByComparator) throws SystemException {
1083        Object[] finderArgs = new Object[] {
1084                String.valueOf(start), String.valueOf(end),
1085                String.valueOf(orderByComparator)
1086            };
1087
1088        List<PollsQuestion> list = (List<PollsQuestion>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1089                finderArgs, this);
1090
1091        if (list == null) {
1092            StringBundler query = null;
1093            String sql = null;
1094
1095            if (orderByComparator != null) {
1096                query = new StringBundler(2 +
1097                        (orderByComparator.getOrderByFields().length * 3));
1098
1099                query.append(_SQL_SELECT_POLLSQUESTION);
1100
1101                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1102                    orderByComparator);
1103
1104                sql = query.toString();
1105            }
1106            else {
1107                sql = _SQL_SELECT_POLLSQUESTION.concat(PollsQuestionModelImpl.ORDER_BY_JPQL);
1108            }
1109
1110            Session session = null;
1111
1112            try {
1113                session = openSession();
1114
1115                Query q = session.createQuery(sql);
1116
1117                if (orderByComparator == null) {
1118                    list = (List<PollsQuestion>)QueryUtil.list(q, getDialect(),
1119                            start, end, false);
1120
1121                    Collections.sort(list);
1122                }
1123                else {
1124                    list = (List<PollsQuestion>)QueryUtil.list(q, getDialect(),
1125                            start, end);
1126                }
1127            }
1128            catch (Exception e) {
1129                throw processException(e);
1130            }
1131            finally {
1132                if (list == null) {
1133                    list = new ArrayList<PollsQuestion>();
1134                }
1135
1136                cacheResult(list);
1137
1138                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1139
1140                closeSession(session);
1141            }
1142        }
1143
1144        return list;
1145    }
1146
1147    public void removeByUuid(String uuid) throws SystemException {
1148        for (PollsQuestion pollsQuestion : findByUuid(uuid)) {
1149            remove(pollsQuestion);
1150        }
1151    }
1152
1153    public void removeByUUID_G(String uuid, long groupId)
1154        throws NoSuchQuestionException, SystemException {
1155        PollsQuestion pollsQuestion = findByUUID_G(uuid, groupId);
1156
1157        remove(pollsQuestion);
1158    }
1159
1160    public void removeByGroupId(long groupId) throws SystemException {
1161        for (PollsQuestion pollsQuestion : findByGroupId(groupId)) {
1162            remove(pollsQuestion);
1163        }
1164    }
1165
1166    public void removeAll() throws SystemException {
1167        for (PollsQuestion pollsQuestion : findAll()) {
1168            remove(pollsQuestion);
1169        }
1170    }
1171
1172    public int countByUuid(String uuid) throws SystemException {
1173        Object[] finderArgs = new Object[] { uuid };
1174
1175        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
1176                finderArgs, this);
1177
1178        if (count == null) {
1179            StringBundler query = new StringBundler(2);
1180
1181            query.append(_SQL_COUNT_POLLSQUESTION_WHERE);
1182
1183            if (uuid == null) {
1184                query.append(_FINDER_COLUMN_UUID_UUID_1);
1185            }
1186            else {
1187                if (uuid.equals(StringPool.BLANK)) {
1188                    query.append(_FINDER_COLUMN_UUID_UUID_3);
1189                }
1190                else {
1191                    query.append(_FINDER_COLUMN_UUID_UUID_2);
1192                }
1193            }
1194
1195            String sql = query.toString();
1196
1197            Session session = null;
1198
1199            try {
1200                session = openSession();
1201
1202                Query q = session.createQuery(sql);
1203
1204                QueryPos qPos = QueryPos.getInstance(q);
1205
1206                if (uuid != null) {
1207                    qPos.add(uuid);
1208                }
1209
1210                count = (Long)q.uniqueResult();
1211            }
1212            catch (Exception e) {
1213                throw processException(e);
1214            }
1215            finally {
1216                if (count == null) {
1217                    count = Long.valueOf(0);
1218                }
1219
1220                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
1221                    finderArgs, count);
1222
1223                closeSession(session);
1224            }
1225        }
1226
1227        return count.intValue();
1228    }
1229
1230    public int countByUUID_G(String uuid, long groupId)
1231        throws SystemException {
1232        Object[] finderArgs = new Object[] { uuid, groupId };
1233
1234        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
1235                finderArgs, this);
1236
1237        if (count == null) {
1238            StringBundler query = new StringBundler(3);
1239
1240            query.append(_SQL_COUNT_POLLSQUESTION_WHERE);
1241
1242            if (uuid == null) {
1243                query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1244            }
1245            else {
1246                if (uuid.equals(StringPool.BLANK)) {
1247                    query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1248                }
1249                else {
1250                    query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1251                }
1252            }
1253
1254            query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1255
1256            String sql = query.toString();
1257
1258            Session session = null;
1259
1260            try {
1261                session = openSession();
1262
1263                Query q = session.createQuery(sql);
1264
1265                QueryPos qPos = QueryPos.getInstance(q);
1266
1267                if (uuid != null) {
1268                    qPos.add(uuid);
1269                }
1270
1271                qPos.add(groupId);
1272
1273                count = (Long)q.uniqueResult();
1274            }
1275            catch (Exception e) {
1276                throw processException(e);
1277            }
1278            finally {
1279                if (count == null) {
1280                    count = Long.valueOf(0);
1281                }
1282
1283                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
1284                    finderArgs, count);
1285
1286                closeSession(session);
1287            }
1288        }
1289
1290        return count.intValue();
1291    }
1292
1293    public int countByGroupId(long groupId) throws SystemException {
1294        Object[] finderArgs = new Object[] { groupId };
1295
1296        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
1297                finderArgs, this);
1298
1299        if (count == null) {
1300            StringBundler query = new StringBundler(2);
1301
1302            query.append(_SQL_COUNT_POLLSQUESTION_WHERE);
1303
1304            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1305
1306            String sql = query.toString();
1307
1308            Session session = null;
1309
1310            try {
1311                session = openSession();
1312
1313                Query q = session.createQuery(sql);
1314
1315                QueryPos qPos = QueryPos.getInstance(q);
1316
1317                qPos.add(groupId);
1318
1319                count = (Long)q.uniqueResult();
1320            }
1321            catch (Exception e) {
1322                throw processException(e);
1323            }
1324            finally {
1325                if (count == null) {
1326                    count = Long.valueOf(0);
1327                }
1328
1329                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
1330                    finderArgs, count);
1331
1332                closeSession(session);
1333            }
1334        }
1335
1336        return count.intValue();
1337    }
1338
1339    public int countAll() throws SystemException {
1340        Object[] finderArgs = new Object[0];
1341
1342        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1343                finderArgs, this);
1344
1345        if (count == null) {
1346            Session session = null;
1347
1348            try {
1349                session = openSession();
1350
1351                Query q = session.createQuery(_SQL_COUNT_POLLSQUESTION);
1352
1353                count = (Long)q.uniqueResult();
1354            }
1355            catch (Exception e) {
1356                throw processException(e);
1357            }
1358            finally {
1359                if (count == null) {
1360                    count = Long.valueOf(0);
1361                }
1362
1363                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1364                    count);
1365
1366                closeSession(session);
1367            }
1368        }
1369
1370        return count.intValue();
1371    }
1372
1373    public void afterPropertiesSet() {
1374        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1375                    com.liferay.portal.util.PropsUtil.get(
1376                        "value.object.listener.com.liferay.portlet.polls.model.PollsQuestion")));
1377
1378        if (listenerClassNames.length > 0) {
1379            try {
1380                List<ModelListener<PollsQuestion>> listenersList = new ArrayList<ModelListener<PollsQuestion>>();
1381
1382                for (String listenerClassName : listenerClassNames) {
1383                    listenersList.add((ModelListener<PollsQuestion>)InstanceFactory.newInstance(
1384                            listenerClassName));
1385                }
1386
1387                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1388            }
1389            catch (Exception e) {
1390                _log.error(e);
1391            }
1392        }
1393    }
1394
1395    public void destroy() {
1396        EntityCacheUtil.removeCache(PollsQuestionImpl.class.getName());
1397        FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1398        FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
1399    }
1400
1401    @BeanReference(type = PollsChoicePersistence.class)
1402    protected PollsChoicePersistence pollsChoicePersistence;
1403    @BeanReference(type = PollsQuestionPersistence.class)
1404    protected PollsQuestionPersistence pollsQuestionPersistence;
1405    @BeanReference(type = PollsVotePersistence.class)
1406    protected PollsVotePersistence pollsVotePersistence;
1407    @BeanReference(type = ResourcePersistence.class)
1408    protected ResourcePersistence resourcePersistence;
1409    @BeanReference(type = UserPersistence.class)
1410    protected UserPersistence userPersistence;
1411    private static final String _SQL_SELECT_POLLSQUESTION = "SELECT pollsQuestion FROM PollsQuestion pollsQuestion";
1412    private static final String _SQL_SELECT_POLLSQUESTION_WHERE = "SELECT pollsQuestion FROM PollsQuestion pollsQuestion WHERE ";
1413    private static final String _SQL_COUNT_POLLSQUESTION = "SELECT COUNT(pollsQuestion) FROM PollsQuestion pollsQuestion";
1414    private static final String _SQL_COUNT_POLLSQUESTION_WHERE = "SELECT COUNT(pollsQuestion) FROM PollsQuestion pollsQuestion WHERE ";
1415    private static final String _FINDER_COLUMN_UUID_UUID_1 = "pollsQuestion.uuid IS NULL";
1416    private static final String _FINDER_COLUMN_UUID_UUID_2 = "pollsQuestion.uuid = ?";
1417    private static final String _FINDER_COLUMN_UUID_UUID_3 = "(pollsQuestion.uuid IS NULL OR pollsQuestion.uuid = ?)";
1418    private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "pollsQuestion.uuid IS NULL AND ";
1419    private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "pollsQuestion.uuid = ? AND ";
1420    private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(pollsQuestion.uuid IS NULL OR pollsQuestion.uuid = ?) AND ";
1421    private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "pollsQuestion.groupId = ?";
1422    private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "pollsQuestion.groupId = ?";
1423    private static final String _ORDER_BY_ENTITY_ALIAS = "pollsQuestion.";
1424    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PollsQuestion exists with the primary key ";
1425    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PollsQuestion exists with the key {";
1426    private static Log _log = LogFactoryUtil.getLog(PollsQuestionPersistenceImpl.class);
1427}