001
014
015 package com.liferay.portlet.polls.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.bean.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderPath;
023 import com.liferay.portal.kernel.dao.orm.Query;
024 import com.liferay.portal.kernel.dao.orm.QueryPos;
025 import com.liferay.portal.kernel.dao.orm.QueryUtil;
026 import com.liferay.portal.kernel.dao.orm.Session;
027 import com.liferay.portal.kernel.exception.SystemException;
028 import com.liferay.portal.kernel.log.Log;
029 import com.liferay.portal.kernel.log.LogFactoryUtil;
030 import com.liferay.portal.kernel.util.GetterUtil;
031 import com.liferay.portal.kernel.util.InstanceFactory;
032 import com.liferay.portal.kernel.util.OrderByComparator;
033 import com.liferay.portal.kernel.util.StringBundler;
034 import com.liferay.portal.kernel.util.StringPool;
035 import com.liferay.portal.kernel.util.StringUtil;
036 import com.liferay.portal.model.CacheModel;
037 import com.liferay.portal.model.ModelListener;
038 import com.liferay.portal.service.persistence.BatchSessionUtil;
039 import com.liferay.portal.service.persistence.ResourcePersistence;
040 import com.liferay.portal.service.persistence.UserPersistence;
041 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
042
043 import com.liferay.portlet.polls.NoSuchVoteException;
044 import com.liferay.portlet.polls.model.PollsVote;
045 import com.liferay.portlet.polls.model.impl.PollsVoteImpl;
046 import com.liferay.portlet.polls.model.impl.PollsVoteModelImpl;
047
048 import java.io.Serializable;
049
050 import java.util.ArrayList;
051 import java.util.Collections;
052 import java.util.List;
053
054
066 public class PollsVotePersistenceImpl extends BasePersistenceImpl<PollsVote>
067 implements PollsVotePersistence {
068
073 public static final String FINDER_CLASS_NAME_ENTITY = PollsVoteImpl.class.getName();
074 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
075 ".List1";
076 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
077 ".List2";
078 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_QUESTIONID =
079 new FinderPath(PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
080 PollsVoteModelImpl.FINDER_CACHE_ENABLED, PollsVoteImpl.class,
081 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByQuestionId",
082 new String[] {
083 Long.class.getName(),
084
085 "java.lang.Integer", "java.lang.Integer",
086 "com.liferay.portal.kernel.util.OrderByComparator"
087 });
088 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_QUESTIONID =
089 new FinderPath(PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
090 PollsVoteModelImpl.FINDER_CACHE_ENABLED, PollsVoteImpl.class,
091 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByQuestionId",
092 new String[] { Long.class.getName() },
093 PollsVoteModelImpl.QUESTIONID_COLUMN_BITMASK);
094 public static final FinderPath FINDER_PATH_COUNT_BY_QUESTIONID = new FinderPath(PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
095 PollsVoteModelImpl.FINDER_CACHE_ENABLED, Long.class,
096 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByQuestionId",
097 new String[] { Long.class.getName() });
098 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_CHOICEID = new FinderPath(PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
099 PollsVoteModelImpl.FINDER_CACHE_ENABLED, PollsVoteImpl.class,
100 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByChoiceId",
101 new String[] {
102 Long.class.getName(),
103
104 "java.lang.Integer", "java.lang.Integer",
105 "com.liferay.portal.kernel.util.OrderByComparator"
106 });
107 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CHOICEID =
108 new FinderPath(PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
109 PollsVoteModelImpl.FINDER_CACHE_ENABLED, PollsVoteImpl.class,
110 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByChoiceId",
111 new String[] { Long.class.getName() },
112 PollsVoteModelImpl.CHOICEID_COLUMN_BITMASK);
113 public static final FinderPath FINDER_PATH_COUNT_BY_CHOICEID = new FinderPath(PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
114 PollsVoteModelImpl.FINDER_CACHE_ENABLED, Long.class,
115 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByChoiceId",
116 new String[] { Long.class.getName() });
117 public static final FinderPath FINDER_PATH_FETCH_BY_Q_U = new FinderPath(PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
118 PollsVoteModelImpl.FINDER_CACHE_ENABLED, PollsVoteImpl.class,
119 FINDER_CLASS_NAME_ENTITY, "fetchByQ_U",
120 new String[] { Long.class.getName(), Long.class.getName() },
121 PollsVoteModelImpl.QUESTIONID_COLUMN_BITMASK |
122 PollsVoteModelImpl.USERID_COLUMN_BITMASK);
123 public static final FinderPath FINDER_PATH_COUNT_BY_Q_U = new FinderPath(PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
124 PollsVoteModelImpl.FINDER_CACHE_ENABLED, Long.class,
125 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByQ_U",
126 new String[] { Long.class.getName(), Long.class.getName() });
127 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
128 PollsVoteModelImpl.FINDER_CACHE_ENABLED, PollsVoteImpl.class,
129 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
130 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
131 PollsVoteModelImpl.FINDER_CACHE_ENABLED, PollsVoteImpl.class,
132 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
133 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
134 PollsVoteModelImpl.FINDER_CACHE_ENABLED, Long.class,
135 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
136
137
142 public void cacheResult(PollsVote pollsVote) {
143 EntityCacheUtil.putResult(PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
144 PollsVoteImpl.class, pollsVote.getPrimaryKey(), pollsVote);
145
146 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_Q_U,
147 new Object[] {
148 Long.valueOf(pollsVote.getQuestionId()),
149 Long.valueOf(pollsVote.getUserId())
150 }, pollsVote);
151
152 pollsVote.resetOriginalValues();
153 }
154
155
160 public void cacheResult(List<PollsVote> pollsVotes) {
161 for (PollsVote pollsVote : pollsVotes) {
162 if (EntityCacheUtil.getResult(
163 PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
164 PollsVoteImpl.class, pollsVote.getPrimaryKey()) == null) {
165 cacheResult(pollsVote);
166 }
167 else {
168 pollsVote.resetOriginalValues();
169 }
170 }
171 }
172
173
180 @Override
181 public void clearCache() {
182 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
183 CacheRegistryUtil.clear(PollsVoteImpl.class.getName());
184 }
185
186 EntityCacheUtil.clearCache(PollsVoteImpl.class.getName());
187
188 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
189 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
190 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
191 }
192
193
200 @Override
201 public void clearCache(PollsVote pollsVote) {
202 EntityCacheUtil.removeResult(PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
203 PollsVoteImpl.class, pollsVote.getPrimaryKey());
204
205 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
206 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
207
208 clearUniqueFindersCache(pollsVote);
209 }
210
211 @Override
212 public void clearCache(List<PollsVote> pollsVotes) {
213 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
214 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
215
216 for (PollsVote pollsVote : pollsVotes) {
217 EntityCacheUtil.removeResult(PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
218 PollsVoteImpl.class, pollsVote.getPrimaryKey());
219
220 clearUniqueFindersCache(pollsVote);
221 }
222 }
223
224 protected void clearUniqueFindersCache(PollsVote pollsVote) {
225 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_Q_U,
226 new Object[] {
227 Long.valueOf(pollsVote.getQuestionId()),
228 Long.valueOf(pollsVote.getUserId())
229 });
230 }
231
232
238 public PollsVote create(long voteId) {
239 PollsVote pollsVote = new PollsVoteImpl();
240
241 pollsVote.setNew(true);
242 pollsVote.setPrimaryKey(voteId);
243
244 return pollsVote;
245 }
246
247
255 public PollsVote remove(long voteId)
256 throws NoSuchVoteException, SystemException {
257 return remove(Long.valueOf(voteId));
258 }
259
260
268 @Override
269 public PollsVote remove(Serializable primaryKey)
270 throws NoSuchVoteException, SystemException {
271 Session session = null;
272
273 try {
274 session = openSession();
275
276 PollsVote pollsVote = (PollsVote)session.get(PollsVoteImpl.class,
277 primaryKey);
278
279 if (pollsVote == null) {
280 if (_log.isWarnEnabled()) {
281 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
282 }
283
284 throw new NoSuchVoteException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
285 primaryKey);
286 }
287
288 return remove(pollsVote);
289 }
290 catch (NoSuchVoteException nsee) {
291 throw nsee;
292 }
293 catch (Exception e) {
294 throw processException(e);
295 }
296 finally {
297 closeSession(session);
298 }
299 }
300
301 @Override
302 protected PollsVote removeImpl(PollsVote pollsVote)
303 throws SystemException {
304 pollsVote = toUnwrappedModel(pollsVote);
305
306 Session session = null;
307
308 try {
309 session = openSession();
310
311 BatchSessionUtil.delete(session, pollsVote);
312 }
313 catch (Exception e) {
314 throw processException(e);
315 }
316 finally {
317 closeSession(session);
318 }
319
320 clearCache(pollsVote);
321
322 return pollsVote;
323 }
324
325 @Override
326 public PollsVote updateImpl(
327 com.liferay.portlet.polls.model.PollsVote pollsVote, boolean merge)
328 throws SystemException {
329 pollsVote = toUnwrappedModel(pollsVote);
330
331 boolean isNew = pollsVote.isNew();
332
333 PollsVoteModelImpl pollsVoteModelImpl = (PollsVoteModelImpl)pollsVote;
334
335 Session session = null;
336
337 try {
338 session = openSession();
339
340 BatchSessionUtil.update(session, pollsVote, merge);
341
342 pollsVote.setNew(false);
343 }
344 catch (Exception e) {
345 throw processException(e);
346 }
347 finally {
348 closeSession(session);
349 }
350
351 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
352
353 if (isNew || !PollsVoteModelImpl.COLUMN_BITMASK_ENABLED) {
354 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
355 }
356
357 else {
358 if ((pollsVoteModelImpl.getColumnBitmask() &
359 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_QUESTIONID.getColumnBitmask()) != 0) {
360 Object[] args = new Object[] {
361 Long.valueOf(pollsVoteModelImpl.getOriginalQuestionId())
362 };
363
364 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_QUESTIONID,
365 args);
366 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_QUESTIONID,
367 args);
368
369 args = new Object[] {
370 Long.valueOf(pollsVoteModelImpl.getQuestionId())
371 };
372
373 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_QUESTIONID,
374 args);
375 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_QUESTIONID,
376 args);
377 }
378
379 if ((pollsVoteModelImpl.getColumnBitmask() &
380 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CHOICEID.getColumnBitmask()) != 0) {
381 Object[] args = new Object[] {
382 Long.valueOf(pollsVoteModelImpl.getOriginalChoiceId())
383 };
384
385 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CHOICEID, args);
386 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CHOICEID,
387 args);
388
389 args = new Object[] {
390 Long.valueOf(pollsVoteModelImpl.getChoiceId())
391 };
392
393 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CHOICEID, args);
394 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CHOICEID,
395 args);
396 }
397 }
398
399 EntityCacheUtil.putResult(PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
400 PollsVoteImpl.class, pollsVote.getPrimaryKey(), pollsVote);
401
402 if (isNew) {
403 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_Q_U,
404 new Object[] {
405 Long.valueOf(pollsVote.getQuestionId()),
406 Long.valueOf(pollsVote.getUserId())
407 }, pollsVote);
408 }
409 else {
410 if ((pollsVoteModelImpl.getColumnBitmask() &
411 FINDER_PATH_FETCH_BY_Q_U.getColumnBitmask()) != 0) {
412 Object[] args = new Object[] {
413 Long.valueOf(pollsVoteModelImpl.getOriginalQuestionId()),
414 Long.valueOf(pollsVoteModelImpl.getOriginalUserId())
415 };
416
417 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_Q_U, args);
418 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_Q_U, args);
419
420 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_Q_U,
421 new Object[] {
422 Long.valueOf(pollsVote.getQuestionId()),
423 Long.valueOf(pollsVote.getUserId())
424 }, pollsVote);
425 }
426 }
427
428 return pollsVote;
429 }
430
431 protected PollsVote toUnwrappedModel(PollsVote pollsVote) {
432 if (pollsVote instanceof PollsVoteImpl) {
433 return pollsVote;
434 }
435
436 PollsVoteImpl pollsVoteImpl = new PollsVoteImpl();
437
438 pollsVoteImpl.setNew(pollsVote.isNew());
439 pollsVoteImpl.setPrimaryKey(pollsVote.getPrimaryKey());
440
441 pollsVoteImpl.setVoteId(pollsVote.getVoteId());
442 pollsVoteImpl.setCompanyId(pollsVote.getCompanyId());
443 pollsVoteImpl.setUserId(pollsVote.getUserId());
444 pollsVoteImpl.setUserName(pollsVote.getUserName());
445 pollsVoteImpl.setCreateDate(pollsVote.getCreateDate());
446 pollsVoteImpl.setModifiedDate(pollsVote.getModifiedDate());
447 pollsVoteImpl.setQuestionId(pollsVote.getQuestionId());
448 pollsVoteImpl.setChoiceId(pollsVote.getChoiceId());
449 pollsVoteImpl.setVoteDate(pollsVote.getVoteDate());
450
451 return pollsVoteImpl;
452 }
453
454
462 @Override
463 public PollsVote findByPrimaryKey(Serializable primaryKey)
464 throws NoSuchModelException, SystemException {
465 return findByPrimaryKey(((Long)primaryKey).longValue());
466 }
467
468
476 public PollsVote findByPrimaryKey(long voteId)
477 throws NoSuchVoteException, SystemException {
478 PollsVote pollsVote = fetchByPrimaryKey(voteId);
479
480 if (pollsVote == null) {
481 if (_log.isWarnEnabled()) {
482 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + voteId);
483 }
484
485 throw new NoSuchVoteException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
486 voteId);
487 }
488
489 return pollsVote;
490 }
491
492
499 @Override
500 public PollsVote fetchByPrimaryKey(Serializable primaryKey)
501 throws SystemException {
502 return fetchByPrimaryKey(((Long)primaryKey).longValue());
503 }
504
505
512 public PollsVote fetchByPrimaryKey(long voteId) throws SystemException {
513 PollsVote pollsVote = (PollsVote)EntityCacheUtil.getResult(PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
514 PollsVoteImpl.class, voteId);
515
516 if (pollsVote == _nullPollsVote) {
517 return null;
518 }
519
520 if (pollsVote == null) {
521 Session session = null;
522
523 boolean hasException = false;
524
525 try {
526 session = openSession();
527
528 pollsVote = (PollsVote)session.get(PollsVoteImpl.class,
529 Long.valueOf(voteId));
530 }
531 catch (Exception e) {
532 hasException = true;
533
534 throw processException(e);
535 }
536 finally {
537 if (pollsVote != null) {
538 cacheResult(pollsVote);
539 }
540 else if (!hasException) {
541 EntityCacheUtil.putResult(PollsVoteModelImpl.ENTITY_CACHE_ENABLED,
542 PollsVoteImpl.class, voteId, _nullPollsVote);
543 }
544
545 closeSession(session);
546 }
547 }
548
549 return pollsVote;
550 }
551
552
559 public List<PollsVote> findByQuestionId(long questionId)
560 throws SystemException {
561 return findByQuestionId(questionId, QueryUtil.ALL_POS,
562 QueryUtil.ALL_POS, null);
563 }
564
565
578 public List<PollsVote> findByQuestionId(long questionId, int start, int end)
579 throws SystemException {
580 return findByQuestionId(questionId, start, end, null);
581 }
582
583
597 public List<PollsVote> findByQuestionId(long questionId, int start,
598 int end, OrderByComparator orderByComparator) throws SystemException {
599 FinderPath finderPath = null;
600 Object[] finderArgs = null;
601
602 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
603 (orderByComparator == null)) {
604 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_QUESTIONID;
605 finderArgs = new Object[] { questionId };
606 }
607 else {
608 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_QUESTIONID;
609 finderArgs = new Object[] { questionId, start, end, orderByComparator };
610 }
611
612 List<PollsVote> list = (List<PollsVote>)FinderCacheUtil.getResult(finderPath,
613 finderArgs, this);
614
615 if (list == null) {
616 StringBundler query = null;
617
618 if (orderByComparator != null) {
619 query = new StringBundler(3 +
620 (orderByComparator.getOrderByFields().length * 3));
621 }
622 else {
623 query = new StringBundler(2);
624 }
625
626 query.append(_SQL_SELECT_POLLSVOTE_WHERE);
627
628 query.append(_FINDER_COLUMN_QUESTIONID_QUESTIONID_2);
629
630 if (orderByComparator != null) {
631 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
632 orderByComparator);
633 }
634
635 String sql = query.toString();
636
637 Session session = null;
638
639 try {
640 session = openSession();
641
642 Query q = session.createQuery(sql);
643
644 QueryPos qPos = QueryPos.getInstance(q);
645
646 qPos.add(questionId);
647
648 list = (List<PollsVote>)QueryUtil.list(q, getDialect(), start,
649 end);
650 }
651 catch (Exception e) {
652 throw processException(e);
653 }
654 finally {
655 if (list == null) {
656 FinderCacheUtil.removeResult(finderPath, finderArgs);
657 }
658 else {
659 cacheResult(list);
660
661 FinderCacheUtil.putResult(finderPath, finderArgs, list);
662 }
663
664 closeSession(session);
665 }
666 }
667
668 return list;
669 }
670
671
684 public PollsVote findByQuestionId_First(long questionId,
685 OrderByComparator orderByComparator)
686 throws NoSuchVoteException, SystemException {
687 List<PollsVote> list = findByQuestionId(questionId, 0, 1,
688 orderByComparator);
689
690 if (list.isEmpty()) {
691 StringBundler msg = new StringBundler(4);
692
693 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
694
695 msg.append("questionId=");
696 msg.append(questionId);
697
698 msg.append(StringPool.CLOSE_CURLY_BRACE);
699
700 throw new NoSuchVoteException(msg.toString());
701 }
702 else {
703 return list.get(0);
704 }
705 }
706
707
720 public PollsVote findByQuestionId_Last(long questionId,
721 OrderByComparator orderByComparator)
722 throws NoSuchVoteException, SystemException {
723 int count = countByQuestionId(questionId);
724
725 List<PollsVote> list = findByQuestionId(questionId, count - 1, count,
726 orderByComparator);
727
728 if (list.isEmpty()) {
729 StringBundler msg = new StringBundler(4);
730
731 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
732
733 msg.append("questionId=");
734 msg.append(questionId);
735
736 msg.append(StringPool.CLOSE_CURLY_BRACE);
737
738 throw new NoSuchVoteException(msg.toString());
739 }
740 else {
741 return list.get(0);
742 }
743 }
744
745
759 public PollsVote[] findByQuestionId_PrevAndNext(long voteId,
760 long questionId, OrderByComparator orderByComparator)
761 throws NoSuchVoteException, SystemException {
762 PollsVote pollsVote = findByPrimaryKey(voteId);
763
764 Session session = null;
765
766 try {
767 session = openSession();
768
769 PollsVote[] array = new PollsVoteImpl[3];
770
771 array[0] = getByQuestionId_PrevAndNext(session, pollsVote,
772 questionId, orderByComparator, true);
773
774 array[1] = pollsVote;
775
776 array[2] = getByQuestionId_PrevAndNext(session, pollsVote,
777 questionId, orderByComparator, false);
778
779 return array;
780 }
781 catch (Exception e) {
782 throw processException(e);
783 }
784 finally {
785 closeSession(session);
786 }
787 }
788
789 protected PollsVote getByQuestionId_PrevAndNext(Session session,
790 PollsVote pollsVote, long questionId,
791 OrderByComparator orderByComparator, boolean previous) {
792 StringBundler query = null;
793
794 if (orderByComparator != null) {
795 query = new StringBundler(6 +
796 (orderByComparator.getOrderByFields().length * 6));
797 }
798 else {
799 query = new StringBundler(3);
800 }
801
802 query.append(_SQL_SELECT_POLLSVOTE_WHERE);
803
804 query.append(_FINDER_COLUMN_QUESTIONID_QUESTIONID_2);
805
806 if (orderByComparator != null) {
807 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
808
809 if (orderByConditionFields.length > 0) {
810 query.append(WHERE_AND);
811 }
812
813 for (int i = 0; i < orderByConditionFields.length; i++) {
814 query.append(_ORDER_BY_ENTITY_ALIAS);
815 query.append(orderByConditionFields[i]);
816
817 if ((i + 1) < orderByConditionFields.length) {
818 if (orderByComparator.isAscending() ^ previous) {
819 query.append(WHERE_GREATER_THAN_HAS_NEXT);
820 }
821 else {
822 query.append(WHERE_LESSER_THAN_HAS_NEXT);
823 }
824 }
825 else {
826 if (orderByComparator.isAscending() ^ previous) {
827 query.append(WHERE_GREATER_THAN);
828 }
829 else {
830 query.append(WHERE_LESSER_THAN);
831 }
832 }
833 }
834
835 query.append(ORDER_BY_CLAUSE);
836
837 String[] orderByFields = orderByComparator.getOrderByFields();
838
839 for (int i = 0; i < orderByFields.length; i++) {
840 query.append(_ORDER_BY_ENTITY_ALIAS);
841 query.append(orderByFields[i]);
842
843 if ((i + 1) < orderByFields.length) {
844 if (orderByComparator.isAscending() ^ previous) {
845 query.append(ORDER_BY_ASC_HAS_NEXT);
846 }
847 else {
848 query.append(ORDER_BY_DESC_HAS_NEXT);
849 }
850 }
851 else {
852 if (orderByComparator.isAscending() ^ previous) {
853 query.append(ORDER_BY_ASC);
854 }
855 else {
856 query.append(ORDER_BY_DESC);
857 }
858 }
859 }
860 }
861
862 String sql = query.toString();
863
864 Query q = session.createQuery(sql);
865
866 q.setFirstResult(0);
867 q.setMaxResults(2);
868
869 QueryPos qPos = QueryPos.getInstance(q);
870
871 qPos.add(questionId);
872
873 if (orderByComparator != null) {
874 Object[] values = orderByComparator.getOrderByConditionValues(pollsVote);
875
876 for (Object value : values) {
877 qPos.add(value);
878 }
879 }
880
881 List<PollsVote> list = q.list();
882
883 if (list.size() == 2) {
884 return list.get(1);
885 }
886 else {
887 return null;
888 }
889 }
890
891
898 public List<PollsVote> findByChoiceId(long choiceId)
899 throws SystemException {
900 return findByChoiceId(choiceId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
901 null);
902 }
903
904
917 public List<PollsVote> findByChoiceId(long choiceId, int start, int end)
918 throws SystemException {
919 return findByChoiceId(choiceId, start, end, null);
920 }
921
922
936 public List<PollsVote> findByChoiceId(long choiceId, int start, int end,
937 OrderByComparator orderByComparator) throws SystemException {
938 FinderPath finderPath = null;
939 Object[] finderArgs = null;
940
941 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
942 (orderByComparator == null)) {
943 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CHOICEID;
944 finderArgs = new Object[] { choiceId };
945 }
946 else {
947 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_CHOICEID;
948 finderArgs = new Object[] { choiceId, start, end, orderByComparator };
949 }
950
951 List<PollsVote> list = (List<PollsVote>)FinderCacheUtil.getResult(finderPath,
952 finderArgs, this);
953
954 if (list == null) {
955 StringBundler query = null;
956
957 if (orderByComparator != null) {
958 query = new StringBundler(3 +
959 (orderByComparator.getOrderByFields().length * 3));
960 }
961 else {
962 query = new StringBundler(2);
963 }
964
965 query.append(_SQL_SELECT_POLLSVOTE_WHERE);
966
967 query.append(_FINDER_COLUMN_CHOICEID_CHOICEID_2);
968
969 if (orderByComparator != null) {
970 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
971 orderByComparator);
972 }
973
974 String sql = query.toString();
975
976 Session session = null;
977
978 try {
979 session = openSession();
980
981 Query q = session.createQuery(sql);
982
983 QueryPos qPos = QueryPos.getInstance(q);
984
985 qPos.add(choiceId);
986
987 list = (List<PollsVote>)QueryUtil.list(q, getDialect(), start,
988 end);
989 }
990 catch (Exception e) {
991 throw processException(e);
992 }
993 finally {
994 if (list == null) {
995 FinderCacheUtil.removeResult(finderPath, finderArgs);
996 }
997 else {
998 cacheResult(list);
999
1000 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1001 }
1002
1003 closeSession(session);
1004 }
1005 }
1006
1007 return list;
1008 }
1009
1010
1023 public PollsVote findByChoiceId_First(long choiceId,
1024 OrderByComparator orderByComparator)
1025 throws NoSuchVoteException, SystemException {
1026 List<PollsVote> list = findByChoiceId(choiceId, 0, 1, orderByComparator);
1027
1028 if (list.isEmpty()) {
1029 StringBundler msg = new StringBundler(4);
1030
1031 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1032
1033 msg.append("choiceId=");
1034 msg.append(choiceId);
1035
1036 msg.append(StringPool.CLOSE_CURLY_BRACE);
1037
1038 throw new NoSuchVoteException(msg.toString());
1039 }
1040 else {
1041 return list.get(0);
1042 }
1043 }
1044
1045
1058 public PollsVote findByChoiceId_Last(long choiceId,
1059 OrderByComparator orderByComparator)
1060 throws NoSuchVoteException, SystemException {
1061 int count = countByChoiceId(choiceId);
1062
1063 List<PollsVote> list = findByChoiceId(choiceId, count - 1, count,
1064 orderByComparator);
1065
1066 if (list.isEmpty()) {
1067 StringBundler msg = new StringBundler(4);
1068
1069 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1070
1071 msg.append("choiceId=");
1072 msg.append(choiceId);
1073
1074 msg.append(StringPool.CLOSE_CURLY_BRACE);
1075
1076 throw new NoSuchVoteException(msg.toString());
1077 }
1078 else {
1079 return list.get(0);
1080 }
1081 }
1082
1083
1097 public PollsVote[] findByChoiceId_PrevAndNext(long voteId, long choiceId,
1098 OrderByComparator orderByComparator)
1099 throws NoSuchVoteException, SystemException {
1100 PollsVote pollsVote = findByPrimaryKey(voteId);
1101
1102 Session session = null;
1103
1104 try {
1105 session = openSession();
1106
1107 PollsVote[] array = new PollsVoteImpl[3];
1108
1109 array[0] = getByChoiceId_PrevAndNext(session, pollsVote, choiceId,
1110 orderByComparator, true);
1111
1112 array[1] = pollsVote;
1113
1114 array[2] = getByChoiceId_PrevAndNext(session, pollsVote, choiceId,
1115 orderByComparator, false);
1116
1117 return array;
1118 }
1119 catch (Exception e) {
1120 throw processException(e);
1121 }
1122 finally {
1123 closeSession(session);
1124 }
1125 }
1126
1127 protected PollsVote getByChoiceId_PrevAndNext(Session session,
1128 PollsVote pollsVote, long choiceId,
1129 OrderByComparator orderByComparator, boolean previous) {
1130 StringBundler query = null;
1131
1132 if (orderByComparator != null) {
1133 query = new StringBundler(6 +
1134 (orderByComparator.getOrderByFields().length * 6));
1135 }
1136 else {
1137 query = new StringBundler(3);
1138 }
1139
1140 query.append(_SQL_SELECT_POLLSVOTE_WHERE);
1141
1142 query.append(_FINDER_COLUMN_CHOICEID_CHOICEID_2);
1143
1144 if (orderByComparator != null) {
1145 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1146
1147 if (orderByConditionFields.length > 0) {
1148 query.append(WHERE_AND);
1149 }
1150
1151 for (int i = 0; i < orderByConditionFields.length; i++) {
1152 query.append(_ORDER_BY_ENTITY_ALIAS);
1153 query.append(orderByConditionFields[i]);
1154
1155 if ((i + 1) < orderByConditionFields.length) {
1156 if (orderByComparator.isAscending() ^ previous) {
1157 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1158 }
1159 else {
1160 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1161 }
1162 }
1163 else {
1164 if (orderByComparator.isAscending() ^ previous) {
1165 query.append(WHERE_GREATER_THAN);
1166 }
1167 else {
1168 query.append(WHERE_LESSER_THAN);
1169 }
1170 }
1171 }
1172
1173 query.append(ORDER_BY_CLAUSE);
1174
1175 String[] orderByFields = orderByComparator.getOrderByFields();
1176
1177 for (int i = 0; i < orderByFields.length; i++) {
1178 query.append(_ORDER_BY_ENTITY_ALIAS);
1179 query.append(orderByFields[i]);
1180
1181 if ((i + 1) < orderByFields.length) {
1182 if (orderByComparator.isAscending() ^ previous) {
1183 query.append(ORDER_BY_ASC_HAS_NEXT);
1184 }
1185 else {
1186 query.append(ORDER_BY_DESC_HAS_NEXT);
1187 }
1188 }
1189 else {
1190 if (orderByComparator.isAscending() ^ previous) {
1191 query.append(ORDER_BY_ASC);
1192 }
1193 else {
1194 query.append(ORDER_BY_DESC);
1195 }
1196 }
1197 }
1198 }
1199
1200 String sql = query.toString();
1201
1202 Query q = session.createQuery(sql);
1203
1204 q.setFirstResult(0);
1205 q.setMaxResults(2);
1206
1207 QueryPos qPos = QueryPos.getInstance(q);
1208
1209 qPos.add(choiceId);
1210
1211 if (orderByComparator != null) {
1212 Object[] values = orderByComparator.getOrderByConditionValues(pollsVote);
1213
1214 for (Object value : values) {
1215 qPos.add(value);
1216 }
1217 }
1218
1219 List<PollsVote> list = q.list();
1220
1221 if (list.size() == 2) {
1222 return list.get(1);
1223 }
1224 else {
1225 return null;
1226 }
1227 }
1228
1229
1238 public PollsVote findByQ_U(long questionId, long userId)
1239 throws NoSuchVoteException, SystemException {
1240 PollsVote pollsVote = fetchByQ_U(questionId, userId);
1241
1242 if (pollsVote == null) {
1243 StringBundler msg = new StringBundler(6);
1244
1245 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1246
1247 msg.append("questionId=");
1248 msg.append(questionId);
1249
1250 msg.append(", userId=");
1251 msg.append(userId);
1252
1253 msg.append(StringPool.CLOSE_CURLY_BRACE);
1254
1255 if (_log.isWarnEnabled()) {
1256 _log.warn(msg.toString());
1257 }
1258
1259 throw new NoSuchVoteException(msg.toString());
1260 }
1261
1262 return pollsVote;
1263 }
1264
1265
1273 public PollsVote fetchByQ_U(long questionId, long userId)
1274 throws SystemException {
1275 return fetchByQ_U(questionId, userId, true);
1276 }
1277
1278
1287 public PollsVote fetchByQ_U(long questionId, long userId,
1288 boolean retrieveFromCache) throws SystemException {
1289 Object[] finderArgs = new Object[] { questionId, userId };
1290
1291 Object result = null;
1292
1293 if (retrieveFromCache) {
1294 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_Q_U,
1295 finderArgs, this);
1296 }
1297
1298 if (result == null) {
1299 StringBundler query = new StringBundler(3);
1300
1301 query.append(_SQL_SELECT_POLLSVOTE_WHERE);
1302
1303 query.append(_FINDER_COLUMN_Q_U_QUESTIONID_2);
1304
1305 query.append(_FINDER_COLUMN_Q_U_USERID_2);
1306
1307 String sql = query.toString();
1308
1309 Session session = null;
1310
1311 try {
1312 session = openSession();
1313
1314 Query q = session.createQuery(sql);
1315
1316 QueryPos qPos = QueryPos.getInstance(q);
1317
1318 qPos.add(questionId);
1319
1320 qPos.add(userId);
1321
1322 List<PollsVote> list = q.list();
1323
1324 result = list;
1325
1326 PollsVote pollsVote = null;
1327
1328 if (list.isEmpty()) {
1329 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_Q_U,
1330 finderArgs, list);
1331 }
1332 else {
1333 pollsVote = list.get(0);
1334
1335 cacheResult(pollsVote);
1336
1337 if ((pollsVote.getQuestionId() != questionId) ||
1338 (pollsVote.getUserId() != userId)) {
1339 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_Q_U,
1340 finderArgs, pollsVote);
1341 }
1342 }
1343
1344 return pollsVote;
1345 }
1346 catch (Exception e) {
1347 throw processException(e);
1348 }
1349 finally {
1350 if (result == null) {
1351 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_Q_U,
1352 finderArgs);
1353 }
1354
1355 closeSession(session);
1356 }
1357 }
1358 else {
1359 if (result instanceof List<?>) {
1360 return null;
1361 }
1362 else {
1363 return (PollsVote)result;
1364 }
1365 }
1366 }
1367
1368
1374 public List<PollsVote> findAll() throws SystemException {
1375 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1376 }
1377
1378
1390 public List<PollsVote> findAll(int start, int end)
1391 throws SystemException {
1392 return findAll(start, end, null);
1393 }
1394
1395
1408 public List<PollsVote> findAll(int start, int end,
1409 OrderByComparator orderByComparator) throws SystemException {
1410 FinderPath finderPath = null;
1411 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1412
1413 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1414 (orderByComparator == null)) {
1415 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1416 finderArgs = FINDER_ARGS_EMPTY;
1417 }
1418 else {
1419 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1420 finderArgs = new Object[] { start, end, orderByComparator };
1421 }
1422
1423 List<PollsVote> list = (List<PollsVote>)FinderCacheUtil.getResult(finderPath,
1424 finderArgs, this);
1425
1426 if (list == null) {
1427 StringBundler query = null;
1428 String sql = null;
1429
1430 if (orderByComparator != null) {
1431 query = new StringBundler(2 +
1432 (orderByComparator.getOrderByFields().length * 3));
1433
1434 query.append(_SQL_SELECT_POLLSVOTE);
1435
1436 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1437 orderByComparator);
1438
1439 sql = query.toString();
1440 }
1441 else {
1442 sql = _SQL_SELECT_POLLSVOTE;
1443 }
1444
1445 Session session = null;
1446
1447 try {
1448 session = openSession();
1449
1450 Query q = session.createQuery(sql);
1451
1452 if (orderByComparator == null) {
1453 list = (List<PollsVote>)QueryUtil.list(q, getDialect(),
1454 start, end, false);
1455
1456 Collections.sort(list);
1457 }
1458 else {
1459 list = (List<PollsVote>)QueryUtil.list(q, getDialect(),
1460 start, end);
1461 }
1462 }
1463 catch (Exception e) {
1464 throw processException(e);
1465 }
1466 finally {
1467 if (list == null) {
1468 FinderCacheUtil.removeResult(finderPath, finderArgs);
1469 }
1470 else {
1471 cacheResult(list);
1472
1473 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1474 }
1475
1476 closeSession(session);
1477 }
1478 }
1479
1480 return list;
1481 }
1482
1483
1489 public void removeByQuestionId(long questionId) throws SystemException {
1490 for (PollsVote pollsVote : findByQuestionId(questionId)) {
1491 remove(pollsVote);
1492 }
1493 }
1494
1495
1501 public void removeByChoiceId(long choiceId) throws SystemException {
1502 for (PollsVote pollsVote : findByChoiceId(choiceId)) {
1503 remove(pollsVote);
1504 }
1505 }
1506
1507
1514 public void removeByQ_U(long questionId, long userId)
1515 throws NoSuchVoteException, SystemException {
1516 PollsVote pollsVote = findByQ_U(questionId, userId);
1517
1518 remove(pollsVote);
1519 }
1520
1521
1526 public void removeAll() throws SystemException {
1527 for (PollsVote pollsVote : findAll()) {
1528 remove(pollsVote);
1529 }
1530 }
1531
1532
1539 public int countByQuestionId(long questionId) throws SystemException {
1540 Object[] finderArgs = new Object[] { questionId };
1541
1542 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_QUESTIONID,
1543 finderArgs, this);
1544
1545 if (count == null) {
1546 StringBundler query = new StringBundler(2);
1547
1548 query.append(_SQL_COUNT_POLLSVOTE_WHERE);
1549
1550 query.append(_FINDER_COLUMN_QUESTIONID_QUESTIONID_2);
1551
1552 String sql = query.toString();
1553
1554 Session session = null;
1555
1556 try {
1557 session = openSession();
1558
1559 Query q = session.createQuery(sql);
1560
1561 QueryPos qPos = QueryPos.getInstance(q);
1562
1563 qPos.add(questionId);
1564
1565 count = (Long)q.uniqueResult();
1566 }
1567 catch (Exception e) {
1568 throw processException(e);
1569 }
1570 finally {
1571 if (count == null) {
1572 count = Long.valueOf(0);
1573 }
1574
1575 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_QUESTIONID,
1576 finderArgs, count);
1577
1578 closeSession(session);
1579 }
1580 }
1581
1582 return count.intValue();
1583 }
1584
1585
1592 public int countByChoiceId(long choiceId) throws SystemException {
1593 Object[] finderArgs = new Object[] { choiceId };
1594
1595 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_CHOICEID,
1596 finderArgs, this);
1597
1598 if (count == null) {
1599 StringBundler query = new StringBundler(2);
1600
1601 query.append(_SQL_COUNT_POLLSVOTE_WHERE);
1602
1603 query.append(_FINDER_COLUMN_CHOICEID_CHOICEID_2);
1604
1605 String sql = query.toString();
1606
1607 Session session = null;
1608
1609 try {
1610 session = openSession();
1611
1612 Query q = session.createQuery(sql);
1613
1614 QueryPos qPos = QueryPos.getInstance(q);
1615
1616 qPos.add(choiceId);
1617
1618 count = (Long)q.uniqueResult();
1619 }
1620 catch (Exception e) {
1621 throw processException(e);
1622 }
1623 finally {
1624 if (count == null) {
1625 count = Long.valueOf(0);
1626 }
1627
1628 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_CHOICEID,
1629 finderArgs, count);
1630
1631 closeSession(session);
1632 }
1633 }
1634
1635 return count.intValue();
1636 }
1637
1638
1646 public int countByQ_U(long questionId, long userId)
1647 throws SystemException {
1648 Object[] finderArgs = new Object[] { questionId, userId };
1649
1650 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_Q_U,
1651 finderArgs, this);
1652
1653 if (count == null) {
1654 StringBundler query = new StringBundler(3);
1655
1656 query.append(_SQL_COUNT_POLLSVOTE_WHERE);
1657
1658 query.append(_FINDER_COLUMN_Q_U_QUESTIONID_2);
1659
1660 query.append(_FINDER_COLUMN_Q_U_USERID_2);
1661
1662 String sql = query.toString();
1663
1664 Session session = null;
1665
1666 try {
1667 session = openSession();
1668
1669 Query q = session.createQuery(sql);
1670
1671 QueryPos qPos = QueryPos.getInstance(q);
1672
1673 qPos.add(questionId);
1674
1675 qPos.add(userId);
1676
1677 count = (Long)q.uniqueResult();
1678 }
1679 catch (Exception e) {
1680 throw processException(e);
1681 }
1682 finally {
1683 if (count == null) {
1684 count = Long.valueOf(0);
1685 }
1686
1687 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_Q_U, finderArgs,
1688 count);
1689
1690 closeSession(session);
1691 }
1692 }
1693
1694 return count.intValue();
1695 }
1696
1697
1703 public int countAll() throws SystemException {
1704 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1705 FINDER_ARGS_EMPTY, this);
1706
1707 if (count == null) {
1708 Session session = null;
1709
1710 try {
1711 session = openSession();
1712
1713 Query q = session.createQuery(_SQL_COUNT_POLLSVOTE);
1714
1715 count = (Long)q.uniqueResult();
1716 }
1717 catch (Exception e) {
1718 throw processException(e);
1719 }
1720 finally {
1721 if (count == null) {
1722 count = Long.valueOf(0);
1723 }
1724
1725 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1726 FINDER_ARGS_EMPTY, count);
1727
1728 closeSession(session);
1729 }
1730 }
1731
1732 return count.intValue();
1733 }
1734
1735
1738 public void afterPropertiesSet() {
1739 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1740 com.liferay.portal.util.PropsUtil.get(
1741 "value.object.listener.com.liferay.portlet.polls.model.PollsVote")));
1742
1743 if (listenerClassNames.length > 0) {
1744 try {
1745 List<ModelListener<PollsVote>> listenersList = new ArrayList<ModelListener<PollsVote>>();
1746
1747 for (String listenerClassName : listenerClassNames) {
1748 listenersList.add((ModelListener<PollsVote>)InstanceFactory.newInstance(
1749 listenerClassName));
1750 }
1751
1752 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1753 }
1754 catch (Exception e) {
1755 _log.error(e);
1756 }
1757 }
1758 }
1759
1760 public void destroy() {
1761 EntityCacheUtil.removeCache(PollsVoteImpl.class.getName());
1762 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1763 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1764 }
1765
1766 @BeanReference(type = PollsChoicePersistence.class)
1767 protected PollsChoicePersistence pollsChoicePersistence;
1768 @BeanReference(type = PollsQuestionPersistence.class)
1769 protected PollsQuestionPersistence pollsQuestionPersistence;
1770 @BeanReference(type = PollsVotePersistence.class)
1771 protected PollsVotePersistence pollsVotePersistence;
1772 @BeanReference(type = ResourcePersistence.class)
1773 protected ResourcePersistence resourcePersistence;
1774 @BeanReference(type = UserPersistence.class)
1775 protected UserPersistence userPersistence;
1776 private static final String _SQL_SELECT_POLLSVOTE = "SELECT pollsVote FROM PollsVote pollsVote";
1777 private static final String _SQL_SELECT_POLLSVOTE_WHERE = "SELECT pollsVote FROM PollsVote pollsVote WHERE ";
1778 private static final String _SQL_COUNT_POLLSVOTE = "SELECT COUNT(pollsVote) FROM PollsVote pollsVote";
1779 private static final String _SQL_COUNT_POLLSVOTE_WHERE = "SELECT COUNT(pollsVote) FROM PollsVote pollsVote WHERE ";
1780 private static final String _FINDER_COLUMN_QUESTIONID_QUESTIONID_2 = "pollsVote.questionId = ?";
1781 private static final String _FINDER_COLUMN_CHOICEID_CHOICEID_2 = "pollsVote.choiceId = ?";
1782 private static final String _FINDER_COLUMN_Q_U_QUESTIONID_2 = "pollsVote.questionId = ? AND ";
1783 private static final String _FINDER_COLUMN_Q_U_USERID_2 = "pollsVote.userId = ?";
1784 private static final String _ORDER_BY_ENTITY_ALIAS = "pollsVote.";
1785 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PollsVote exists with the primary key ";
1786 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PollsVote exists with the key {";
1787 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1788 private static Log _log = LogFactoryUtil.getLog(PollsVotePersistenceImpl.class);
1789 private static PollsVote _nullPollsVote = new PollsVoteImpl() {
1790 @Override
1791 public Object clone() {
1792 return this;
1793 }
1794
1795 @Override
1796 public CacheModel<PollsVote> toCacheModel() {
1797 return _nullPollsVoteCacheModel;
1798 }
1799 };
1800
1801 private static CacheModel<PollsVote> _nullPollsVoteCacheModel = new CacheModel<PollsVote>() {
1802 public PollsVote toEntityModel() {
1803 return _nullPollsVote;
1804 }
1805 };
1806 }