001
014
015 package com.liferay.portlet.ratings.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.ratings.NoSuchStatsException;
044 import com.liferay.portlet.ratings.model.RatingsStats;
045 import com.liferay.portlet.ratings.model.impl.RatingsStatsImpl;
046 import com.liferay.portlet.ratings.model.impl.RatingsStatsModelImpl;
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 RatingsStatsPersistenceImpl extends BasePersistenceImpl<RatingsStats>
067 implements RatingsStatsPersistence {
068
073 public static final String FINDER_CLASS_NAME_ENTITY = RatingsStatsImpl.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_FETCH_BY_C_C = new FinderPath(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
079 RatingsStatsModelImpl.FINDER_CACHE_ENABLED, RatingsStatsImpl.class,
080 FINDER_CLASS_NAME_ENTITY, "fetchByC_C",
081 new String[] { Long.class.getName(), Long.class.getName() },
082 RatingsStatsModelImpl.CLASSNAMEID_COLUMN_BITMASK |
083 RatingsStatsModelImpl.CLASSPK_COLUMN_BITMASK);
084 public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
085 RatingsStatsModelImpl.FINDER_CACHE_ENABLED, Long.class,
086 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C",
087 new String[] { Long.class.getName(), Long.class.getName() });
088 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
089 RatingsStatsModelImpl.FINDER_CACHE_ENABLED, RatingsStatsImpl.class,
090 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
091 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
092 RatingsStatsModelImpl.FINDER_CACHE_ENABLED, RatingsStatsImpl.class,
093 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
094 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
095 RatingsStatsModelImpl.FINDER_CACHE_ENABLED, Long.class,
096 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
097
098
103 public void cacheResult(RatingsStats ratingsStats) {
104 EntityCacheUtil.putResult(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
105 RatingsStatsImpl.class, ratingsStats.getPrimaryKey(), ratingsStats);
106
107 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
108 new Object[] {
109 Long.valueOf(ratingsStats.getClassNameId()),
110 Long.valueOf(ratingsStats.getClassPK())
111 }, ratingsStats);
112
113 ratingsStats.resetOriginalValues();
114 }
115
116
121 public void cacheResult(List<RatingsStats> ratingsStatses) {
122 for (RatingsStats ratingsStats : ratingsStatses) {
123 if (EntityCacheUtil.getResult(
124 RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
125 RatingsStatsImpl.class, ratingsStats.getPrimaryKey()) == null) {
126 cacheResult(ratingsStats);
127 }
128 else {
129 ratingsStats.resetOriginalValues();
130 }
131 }
132 }
133
134
141 @Override
142 public void clearCache() {
143 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
144 CacheRegistryUtil.clear(RatingsStatsImpl.class.getName());
145 }
146
147 EntityCacheUtil.clearCache(RatingsStatsImpl.class.getName());
148
149 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
150 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
151 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
152 }
153
154
161 @Override
162 public void clearCache(RatingsStats ratingsStats) {
163 EntityCacheUtil.removeResult(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
164 RatingsStatsImpl.class, ratingsStats.getPrimaryKey());
165
166 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
167 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
168
169 clearUniqueFindersCache(ratingsStats);
170 }
171
172 @Override
173 public void clearCache(List<RatingsStats> ratingsStatses) {
174 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
175 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
176
177 for (RatingsStats ratingsStats : ratingsStatses) {
178 EntityCacheUtil.removeResult(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
179 RatingsStatsImpl.class, ratingsStats.getPrimaryKey());
180
181 clearUniqueFindersCache(ratingsStats);
182 }
183 }
184
185 protected void clearUniqueFindersCache(RatingsStats ratingsStats) {
186 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
187 new Object[] {
188 Long.valueOf(ratingsStats.getClassNameId()),
189 Long.valueOf(ratingsStats.getClassPK())
190 });
191 }
192
193
199 public RatingsStats create(long statsId) {
200 RatingsStats ratingsStats = new RatingsStatsImpl();
201
202 ratingsStats.setNew(true);
203 ratingsStats.setPrimaryKey(statsId);
204
205 return ratingsStats;
206 }
207
208
216 public RatingsStats remove(long statsId)
217 throws NoSuchStatsException, SystemException {
218 return remove(Long.valueOf(statsId));
219 }
220
221
229 @Override
230 public RatingsStats remove(Serializable primaryKey)
231 throws NoSuchStatsException, SystemException {
232 Session session = null;
233
234 try {
235 session = openSession();
236
237 RatingsStats ratingsStats = (RatingsStats)session.get(RatingsStatsImpl.class,
238 primaryKey);
239
240 if (ratingsStats == null) {
241 if (_log.isWarnEnabled()) {
242 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
243 }
244
245 throw new NoSuchStatsException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
246 primaryKey);
247 }
248
249 return remove(ratingsStats);
250 }
251 catch (NoSuchStatsException nsee) {
252 throw nsee;
253 }
254 catch (Exception e) {
255 throw processException(e);
256 }
257 finally {
258 closeSession(session);
259 }
260 }
261
262 @Override
263 protected RatingsStats removeImpl(RatingsStats ratingsStats)
264 throws SystemException {
265 ratingsStats = toUnwrappedModel(ratingsStats);
266
267 Session session = null;
268
269 try {
270 session = openSession();
271
272 BatchSessionUtil.delete(session, ratingsStats);
273 }
274 catch (Exception e) {
275 throw processException(e);
276 }
277 finally {
278 closeSession(session);
279 }
280
281 clearCache(ratingsStats);
282
283 return ratingsStats;
284 }
285
286 @Override
287 public RatingsStats updateImpl(
288 com.liferay.portlet.ratings.model.RatingsStats ratingsStats,
289 boolean merge) throws SystemException {
290 ratingsStats = toUnwrappedModel(ratingsStats);
291
292 boolean isNew = ratingsStats.isNew();
293
294 RatingsStatsModelImpl ratingsStatsModelImpl = (RatingsStatsModelImpl)ratingsStats;
295
296 Session session = null;
297
298 try {
299 session = openSession();
300
301 BatchSessionUtil.update(session, ratingsStats, merge);
302
303 ratingsStats.setNew(false);
304 }
305 catch (Exception e) {
306 throw processException(e);
307 }
308 finally {
309 closeSession(session);
310 }
311
312 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
313
314 if (isNew || !RatingsStatsModelImpl.COLUMN_BITMASK_ENABLED) {
315 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
316 }
317
318 EntityCacheUtil.putResult(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
319 RatingsStatsImpl.class, ratingsStats.getPrimaryKey(), ratingsStats);
320
321 if (isNew) {
322 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
323 new Object[] {
324 Long.valueOf(ratingsStats.getClassNameId()),
325 Long.valueOf(ratingsStats.getClassPK())
326 }, ratingsStats);
327 }
328 else {
329 if ((ratingsStatsModelImpl.getColumnBitmask() &
330 FINDER_PATH_FETCH_BY_C_C.getColumnBitmask()) != 0) {
331 Object[] args = new Object[] {
332 Long.valueOf(ratingsStatsModelImpl.getOriginalClassNameId()),
333 Long.valueOf(ratingsStatsModelImpl.getOriginalClassPK())
334 };
335
336 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
337 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C, args);
338
339 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
340 new Object[] {
341 Long.valueOf(ratingsStats.getClassNameId()),
342 Long.valueOf(ratingsStats.getClassPK())
343 }, ratingsStats);
344 }
345 }
346
347 return ratingsStats;
348 }
349
350 protected RatingsStats toUnwrappedModel(RatingsStats ratingsStats) {
351 if (ratingsStats instanceof RatingsStatsImpl) {
352 return ratingsStats;
353 }
354
355 RatingsStatsImpl ratingsStatsImpl = new RatingsStatsImpl();
356
357 ratingsStatsImpl.setNew(ratingsStats.isNew());
358 ratingsStatsImpl.setPrimaryKey(ratingsStats.getPrimaryKey());
359
360 ratingsStatsImpl.setStatsId(ratingsStats.getStatsId());
361 ratingsStatsImpl.setClassNameId(ratingsStats.getClassNameId());
362 ratingsStatsImpl.setClassPK(ratingsStats.getClassPK());
363 ratingsStatsImpl.setTotalEntries(ratingsStats.getTotalEntries());
364 ratingsStatsImpl.setTotalScore(ratingsStats.getTotalScore());
365 ratingsStatsImpl.setAverageScore(ratingsStats.getAverageScore());
366
367 return ratingsStatsImpl;
368 }
369
370
378 @Override
379 public RatingsStats findByPrimaryKey(Serializable primaryKey)
380 throws NoSuchModelException, SystemException {
381 return findByPrimaryKey(((Long)primaryKey).longValue());
382 }
383
384
392 public RatingsStats findByPrimaryKey(long statsId)
393 throws NoSuchStatsException, SystemException {
394 RatingsStats ratingsStats = fetchByPrimaryKey(statsId);
395
396 if (ratingsStats == null) {
397 if (_log.isWarnEnabled()) {
398 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + statsId);
399 }
400
401 throw new NoSuchStatsException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
402 statsId);
403 }
404
405 return ratingsStats;
406 }
407
408
415 @Override
416 public RatingsStats fetchByPrimaryKey(Serializable primaryKey)
417 throws SystemException {
418 return fetchByPrimaryKey(((Long)primaryKey).longValue());
419 }
420
421
428 public RatingsStats fetchByPrimaryKey(long statsId)
429 throws SystemException {
430 RatingsStats ratingsStats = (RatingsStats)EntityCacheUtil.getResult(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
431 RatingsStatsImpl.class, statsId);
432
433 if (ratingsStats == _nullRatingsStats) {
434 return null;
435 }
436
437 if (ratingsStats == null) {
438 Session session = null;
439
440 boolean hasException = false;
441
442 try {
443 session = openSession();
444
445 ratingsStats = (RatingsStats)session.get(RatingsStatsImpl.class,
446 Long.valueOf(statsId));
447 }
448 catch (Exception e) {
449 hasException = true;
450
451 throw processException(e);
452 }
453 finally {
454 if (ratingsStats != null) {
455 cacheResult(ratingsStats);
456 }
457 else if (!hasException) {
458 EntityCacheUtil.putResult(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
459 RatingsStatsImpl.class, statsId, _nullRatingsStats);
460 }
461
462 closeSession(session);
463 }
464 }
465
466 return ratingsStats;
467 }
468
469
478 public RatingsStats findByC_C(long classNameId, long classPK)
479 throws NoSuchStatsException, SystemException {
480 RatingsStats ratingsStats = fetchByC_C(classNameId, classPK);
481
482 if (ratingsStats == null) {
483 StringBundler msg = new StringBundler(6);
484
485 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
486
487 msg.append("classNameId=");
488 msg.append(classNameId);
489
490 msg.append(", classPK=");
491 msg.append(classPK);
492
493 msg.append(StringPool.CLOSE_CURLY_BRACE);
494
495 if (_log.isWarnEnabled()) {
496 _log.warn(msg.toString());
497 }
498
499 throw new NoSuchStatsException(msg.toString());
500 }
501
502 return ratingsStats;
503 }
504
505
513 public RatingsStats fetchByC_C(long classNameId, long classPK)
514 throws SystemException {
515 return fetchByC_C(classNameId, classPK, true);
516 }
517
518
527 public RatingsStats fetchByC_C(long classNameId, long classPK,
528 boolean retrieveFromCache) throws SystemException {
529 Object[] finderArgs = new Object[] { classNameId, classPK };
530
531 Object result = null;
532
533 if (retrieveFromCache) {
534 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C,
535 finderArgs, this);
536 }
537
538 if (result == null) {
539 StringBundler query = new StringBundler(3);
540
541 query.append(_SQL_SELECT_RATINGSSTATS_WHERE);
542
543 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
544
545 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
546
547 String sql = query.toString();
548
549 Session session = null;
550
551 try {
552 session = openSession();
553
554 Query q = session.createQuery(sql);
555
556 QueryPos qPos = QueryPos.getInstance(q);
557
558 qPos.add(classNameId);
559
560 qPos.add(classPK);
561
562 List<RatingsStats> list = q.list();
563
564 result = list;
565
566 RatingsStats ratingsStats = null;
567
568 if (list.isEmpty()) {
569 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
570 finderArgs, list);
571 }
572 else {
573 ratingsStats = list.get(0);
574
575 cacheResult(ratingsStats);
576
577 if ((ratingsStats.getClassNameId() != classNameId) ||
578 (ratingsStats.getClassPK() != classPK)) {
579 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
580 finderArgs, ratingsStats);
581 }
582 }
583
584 return ratingsStats;
585 }
586 catch (Exception e) {
587 throw processException(e);
588 }
589 finally {
590 if (result == null) {
591 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
592 finderArgs);
593 }
594
595 closeSession(session);
596 }
597 }
598 else {
599 if (result instanceof List<?>) {
600 return null;
601 }
602 else {
603 return (RatingsStats)result;
604 }
605 }
606 }
607
608
614 public List<RatingsStats> findAll() throws SystemException {
615 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
616 }
617
618
630 public List<RatingsStats> findAll(int start, int end)
631 throws SystemException {
632 return findAll(start, end, null);
633 }
634
635
648 public List<RatingsStats> findAll(int start, int end,
649 OrderByComparator orderByComparator) throws SystemException {
650 FinderPath finderPath = null;
651 Object[] finderArgs = new Object[] { start, end, orderByComparator };
652
653 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
654 (orderByComparator == null)) {
655 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
656 finderArgs = FINDER_ARGS_EMPTY;
657 }
658 else {
659 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
660 finderArgs = new Object[] { start, end, orderByComparator };
661 }
662
663 List<RatingsStats> list = (List<RatingsStats>)FinderCacheUtil.getResult(finderPath,
664 finderArgs, this);
665
666 if (list == null) {
667 StringBundler query = null;
668 String sql = null;
669
670 if (orderByComparator != null) {
671 query = new StringBundler(2 +
672 (orderByComparator.getOrderByFields().length * 3));
673
674 query.append(_SQL_SELECT_RATINGSSTATS);
675
676 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
677 orderByComparator);
678
679 sql = query.toString();
680 }
681 else {
682 sql = _SQL_SELECT_RATINGSSTATS;
683 }
684
685 Session session = null;
686
687 try {
688 session = openSession();
689
690 Query q = session.createQuery(sql);
691
692 if (orderByComparator == null) {
693 list = (List<RatingsStats>)QueryUtil.list(q, getDialect(),
694 start, end, false);
695
696 Collections.sort(list);
697 }
698 else {
699 list = (List<RatingsStats>)QueryUtil.list(q, getDialect(),
700 start, end);
701 }
702 }
703 catch (Exception e) {
704 throw processException(e);
705 }
706 finally {
707 if (list == null) {
708 FinderCacheUtil.removeResult(finderPath, finderArgs);
709 }
710 else {
711 cacheResult(list);
712
713 FinderCacheUtil.putResult(finderPath, finderArgs, list);
714 }
715
716 closeSession(session);
717 }
718 }
719
720 return list;
721 }
722
723
730 public void removeByC_C(long classNameId, long classPK)
731 throws NoSuchStatsException, SystemException {
732 RatingsStats ratingsStats = findByC_C(classNameId, classPK);
733
734 remove(ratingsStats);
735 }
736
737
742 public void removeAll() throws SystemException {
743 for (RatingsStats ratingsStats : findAll()) {
744 remove(ratingsStats);
745 }
746 }
747
748
756 public int countByC_C(long classNameId, long classPK)
757 throws SystemException {
758 Object[] finderArgs = new Object[] { classNameId, classPK };
759
760 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
761 finderArgs, this);
762
763 if (count == null) {
764 StringBundler query = new StringBundler(3);
765
766 query.append(_SQL_COUNT_RATINGSSTATS_WHERE);
767
768 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
769
770 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
771
772 String sql = query.toString();
773
774 Session session = null;
775
776 try {
777 session = openSession();
778
779 Query q = session.createQuery(sql);
780
781 QueryPos qPos = QueryPos.getInstance(q);
782
783 qPos.add(classNameId);
784
785 qPos.add(classPK);
786
787 count = (Long)q.uniqueResult();
788 }
789 catch (Exception e) {
790 throw processException(e);
791 }
792 finally {
793 if (count == null) {
794 count = Long.valueOf(0);
795 }
796
797 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
798 count);
799
800 closeSession(session);
801 }
802 }
803
804 return count.intValue();
805 }
806
807
813 public int countAll() throws SystemException {
814 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
815 FINDER_ARGS_EMPTY, this);
816
817 if (count == null) {
818 Session session = null;
819
820 try {
821 session = openSession();
822
823 Query q = session.createQuery(_SQL_COUNT_RATINGSSTATS);
824
825 count = (Long)q.uniqueResult();
826 }
827 catch (Exception e) {
828 throw processException(e);
829 }
830 finally {
831 if (count == null) {
832 count = Long.valueOf(0);
833 }
834
835 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
836 FINDER_ARGS_EMPTY, count);
837
838 closeSession(session);
839 }
840 }
841
842 return count.intValue();
843 }
844
845
848 public void afterPropertiesSet() {
849 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
850 com.liferay.portal.util.PropsUtil.get(
851 "value.object.listener.com.liferay.portlet.ratings.model.RatingsStats")));
852
853 if (listenerClassNames.length > 0) {
854 try {
855 List<ModelListener<RatingsStats>> listenersList = new ArrayList<ModelListener<RatingsStats>>();
856
857 for (String listenerClassName : listenerClassNames) {
858 listenersList.add((ModelListener<RatingsStats>)InstanceFactory.newInstance(
859 listenerClassName));
860 }
861
862 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
863 }
864 catch (Exception e) {
865 _log.error(e);
866 }
867 }
868 }
869
870 public void destroy() {
871 EntityCacheUtil.removeCache(RatingsStatsImpl.class.getName());
872 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
873 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
874 }
875
876 @BeanReference(type = RatingsEntryPersistence.class)
877 protected RatingsEntryPersistence ratingsEntryPersistence;
878 @BeanReference(type = RatingsStatsPersistence.class)
879 protected RatingsStatsPersistence ratingsStatsPersistence;
880 @BeanReference(type = ResourcePersistence.class)
881 protected ResourcePersistence resourcePersistence;
882 @BeanReference(type = UserPersistence.class)
883 protected UserPersistence userPersistence;
884 private static final String _SQL_SELECT_RATINGSSTATS = "SELECT ratingsStats FROM RatingsStats ratingsStats";
885 private static final String _SQL_SELECT_RATINGSSTATS_WHERE = "SELECT ratingsStats FROM RatingsStats ratingsStats WHERE ";
886 private static final String _SQL_COUNT_RATINGSSTATS = "SELECT COUNT(ratingsStats) FROM RatingsStats ratingsStats";
887 private static final String _SQL_COUNT_RATINGSSTATS_WHERE = "SELECT COUNT(ratingsStats) FROM RatingsStats ratingsStats WHERE ";
888 private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "ratingsStats.classNameId = ? AND ";
889 private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "ratingsStats.classPK = ?";
890 private static final String _ORDER_BY_ENTITY_ALIAS = "ratingsStats.";
891 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No RatingsStats exists with the primary key ";
892 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No RatingsStats exists with the key {";
893 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
894 private static Log _log = LogFactoryUtil.getLog(RatingsStatsPersistenceImpl.class);
895 private static RatingsStats _nullRatingsStats = new RatingsStatsImpl() {
896 @Override
897 public Object clone() {
898 return this;
899 }
900
901 @Override
902 public CacheModel<RatingsStats> toCacheModel() {
903 return _nullRatingsStatsCacheModel;
904 }
905 };
906
907 private static CacheModel<RatingsStats> _nullRatingsStatsCacheModel = new CacheModel<RatingsStats>() {
908 public RatingsStats toEntityModel() {
909 return _nullRatingsStats;
910 }
911 };
912 }