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.ratings.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.DynamicQuery;
22  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
23  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
24  import com.liferay.portal.kernel.dao.orm.FinderPath;
25  import com.liferay.portal.kernel.dao.orm.Query;
26  import com.liferay.portal.kernel.dao.orm.QueryPos;
27  import com.liferay.portal.kernel.dao.orm.QueryUtil;
28  import com.liferay.portal.kernel.dao.orm.Session;
29  import com.liferay.portal.kernel.log.Log;
30  import com.liferay.portal.kernel.log.LogFactoryUtil;
31  import com.liferay.portal.kernel.util.GetterUtil;
32  import com.liferay.portal.kernel.util.OrderByComparator;
33  import com.liferay.portal.kernel.util.StringBundler;
34  import com.liferay.portal.kernel.util.StringPool;
35  import com.liferay.portal.kernel.util.StringUtil;
36  import com.liferay.portal.model.ModelListener;
37  import com.liferay.portal.service.persistence.BatchSessionUtil;
38  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
39  
40  import com.liferay.portlet.ratings.NoSuchStatsException;
41  import com.liferay.portlet.ratings.model.RatingsStats;
42  import com.liferay.portlet.ratings.model.impl.RatingsStatsImpl;
43  import com.liferay.portlet.ratings.model.impl.RatingsStatsModelImpl;
44  
45  import java.io.Serializable;
46  
47  import java.util.ArrayList;
48  import java.util.Collections;
49  import java.util.List;
50  
51  /**
52   * <a href="RatingsStatsPersistenceImpl.java.html"><b><i>View Source</i></b></a>
53   *
54   * <p>
55   * ServiceBuilder generated this class. Modifications in this class will be
56   * overwritten the next time is generated.
57   * </p>
58   *
59   * @author    Brian Wing Shun Chan
60   * @see       RatingsStatsPersistence
61   * @see       RatingsStatsUtil
62   * @generated
63   */
64  public class RatingsStatsPersistenceImpl extends BasePersistenceImpl<RatingsStats>
65      implements RatingsStatsPersistence {
66      public static final String FINDER_CLASS_NAME_ENTITY = RatingsStatsImpl.class.getName();
67      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
68          ".List";
69      public static final FinderPath FINDER_PATH_FETCH_BY_C_C = new FinderPath(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
70              RatingsStatsModelImpl.FINDER_CACHE_ENABLED,
71              FINDER_CLASS_NAME_ENTITY, "fetchByC_C",
72              new String[] { Long.class.getName(), Long.class.getName() });
73      public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
74              RatingsStatsModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
75              "countByC_C",
76              new String[] { Long.class.getName(), Long.class.getName() });
77      public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
78              RatingsStatsModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
79              "findAll", new String[0]);
80      public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
81              RatingsStatsModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
82              "countAll", new String[0]);
83  
84      public void cacheResult(RatingsStats ratingsStats) {
85          EntityCacheUtil.putResult(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
86              RatingsStatsImpl.class, ratingsStats.getPrimaryKey(), ratingsStats);
87  
88          FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
89              new Object[] {
90                  new Long(ratingsStats.getClassNameId()),
91                  new Long(ratingsStats.getClassPK())
92              }, ratingsStats);
93      }
94  
95      public void cacheResult(List<RatingsStats> ratingsStatses) {
96          for (RatingsStats ratingsStats : ratingsStatses) {
97              if (EntityCacheUtil.getResult(
98                          RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
99                          RatingsStatsImpl.class, ratingsStats.getPrimaryKey(),
100                         this) == null) {
101                 cacheResult(ratingsStats);
102             }
103         }
104     }
105 
106     public void clearCache() {
107         CacheRegistry.clear(RatingsStatsImpl.class.getName());
108         EntityCacheUtil.clearCache(RatingsStatsImpl.class.getName());
109         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
110         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
111     }
112 
113     public RatingsStats create(long statsId) {
114         RatingsStats ratingsStats = new RatingsStatsImpl();
115 
116         ratingsStats.setNew(true);
117         ratingsStats.setPrimaryKey(statsId);
118 
119         return ratingsStats;
120     }
121 
122     public RatingsStats remove(Serializable primaryKey)
123         throws NoSuchModelException, SystemException {
124         return remove(((Long)primaryKey).longValue());
125     }
126 
127     public RatingsStats remove(long statsId)
128         throws NoSuchStatsException, SystemException {
129         Session session = null;
130 
131         try {
132             session = openSession();
133 
134             RatingsStats ratingsStats = (RatingsStats)session.get(RatingsStatsImpl.class,
135                     new Long(statsId));
136 
137             if (ratingsStats == null) {
138                 if (_log.isWarnEnabled()) {
139                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + statsId);
140                 }
141 
142                 throw new NoSuchStatsException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
143                     statsId);
144             }
145 
146             return remove(ratingsStats);
147         }
148         catch (NoSuchStatsException nsee) {
149             throw nsee;
150         }
151         catch (Exception e) {
152             throw processException(e);
153         }
154         finally {
155             closeSession(session);
156         }
157     }
158 
159     public RatingsStats remove(RatingsStats ratingsStats)
160         throws SystemException {
161         for (ModelListener<RatingsStats> listener : listeners) {
162             listener.onBeforeRemove(ratingsStats);
163         }
164 
165         ratingsStats = removeImpl(ratingsStats);
166 
167         for (ModelListener<RatingsStats> listener : listeners) {
168             listener.onAfterRemove(ratingsStats);
169         }
170 
171         return ratingsStats;
172     }
173 
174     protected RatingsStats removeImpl(RatingsStats ratingsStats)
175         throws SystemException {
176         ratingsStats = toUnwrappedModel(ratingsStats);
177 
178         Session session = null;
179 
180         try {
181             session = openSession();
182 
183             if (ratingsStats.isCachedModel() || BatchSessionUtil.isEnabled()) {
184                 Object staleObject = session.get(RatingsStatsImpl.class,
185                         ratingsStats.getPrimaryKeyObj());
186 
187                 if (staleObject != null) {
188                     session.evict(staleObject);
189                 }
190             }
191 
192             session.delete(ratingsStats);
193 
194             session.flush();
195         }
196         catch (Exception e) {
197             throw processException(e);
198         }
199         finally {
200             closeSession(session);
201         }
202 
203         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
204 
205         RatingsStatsModelImpl ratingsStatsModelImpl = (RatingsStatsModelImpl)ratingsStats;
206 
207         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
208             new Object[] {
209                 new Long(ratingsStatsModelImpl.getOriginalClassNameId()),
210                 new Long(ratingsStatsModelImpl.getOriginalClassPK())
211             });
212 
213         EntityCacheUtil.removeResult(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
214             RatingsStatsImpl.class, ratingsStats.getPrimaryKey());
215 
216         return ratingsStats;
217     }
218 
219     /**
220      * @deprecated Use {@link BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)}.
221      */
222     public RatingsStats update(RatingsStats ratingsStats)
223         throws SystemException {
224         if (_log.isWarnEnabled()) {
225             _log.warn(
226                 "Using the deprecated update(RatingsStats ratingsStats) method. Use update(RatingsStats ratingsStats, boolean merge) instead.");
227         }
228 
229         return update(ratingsStats, false);
230     }
231 
232     public RatingsStats updateImpl(
233         com.liferay.portlet.ratings.model.RatingsStats ratingsStats,
234         boolean merge) throws SystemException {
235         ratingsStats = toUnwrappedModel(ratingsStats);
236 
237         boolean isNew = ratingsStats.isNew();
238 
239         RatingsStatsModelImpl ratingsStatsModelImpl = (RatingsStatsModelImpl)ratingsStats;
240 
241         Session session = null;
242 
243         try {
244             session = openSession();
245 
246             BatchSessionUtil.update(session, ratingsStats, merge);
247 
248             ratingsStats.setNew(false);
249         }
250         catch (Exception e) {
251             throw processException(e);
252         }
253         finally {
254             closeSession(session);
255         }
256 
257         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
258 
259         EntityCacheUtil.putResult(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
260             RatingsStatsImpl.class, ratingsStats.getPrimaryKey(), ratingsStats);
261 
262         if (!isNew &&
263                 ((ratingsStats.getClassNameId() != ratingsStatsModelImpl.getOriginalClassNameId()) ||
264                 (ratingsStats.getClassPK() != ratingsStatsModelImpl.getOriginalClassPK()))) {
265             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
266                 new Object[] {
267                     new Long(ratingsStatsModelImpl.getOriginalClassNameId()),
268                     new Long(ratingsStatsModelImpl.getOriginalClassPK())
269                 });
270         }
271 
272         if (isNew ||
273                 ((ratingsStats.getClassNameId() != ratingsStatsModelImpl.getOriginalClassNameId()) ||
274                 (ratingsStats.getClassPK() != ratingsStatsModelImpl.getOriginalClassPK()))) {
275             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
276                 new Object[] {
277                     new Long(ratingsStats.getClassNameId()),
278                     new Long(ratingsStats.getClassPK())
279                 }, ratingsStats);
280         }
281 
282         return ratingsStats;
283     }
284 
285     protected RatingsStats toUnwrappedModel(RatingsStats ratingsStats) {
286         if (ratingsStats instanceof RatingsStatsImpl) {
287             return ratingsStats;
288         }
289 
290         RatingsStatsImpl ratingsStatsImpl = new RatingsStatsImpl();
291 
292         ratingsStatsImpl.setNew(ratingsStats.isNew());
293         ratingsStatsImpl.setPrimaryKey(ratingsStats.getPrimaryKey());
294 
295         ratingsStatsImpl.setStatsId(ratingsStats.getStatsId());
296         ratingsStatsImpl.setClassNameId(ratingsStats.getClassNameId());
297         ratingsStatsImpl.setClassPK(ratingsStats.getClassPK());
298         ratingsStatsImpl.setTotalEntries(ratingsStats.getTotalEntries());
299         ratingsStatsImpl.setTotalScore(ratingsStats.getTotalScore());
300         ratingsStatsImpl.setAverageScore(ratingsStats.getAverageScore());
301 
302         return ratingsStatsImpl;
303     }
304 
305     public RatingsStats findByPrimaryKey(Serializable primaryKey)
306         throws NoSuchModelException, SystemException {
307         return findByPrimaryKey(((Long)primaryKey).longValue());
308     }
309 
310     public RatingsStats findByPrimaryKey(long statsId)
311         throws NoSuchStatsException, SystemException {
312         RatingsStats ratingsStats = fetchByPrimaryKey(statsId);
313 
314         if (ratingsStats == null) {
315             if (_log.isWarnEnabled()) {
316                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + statsId);
317             }
318 
319             throw new NoSuchStatsException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
320                 statsId);
321         }
322 
323         return ratingsStats;
324     }
325 
326     public RatingsStats fetchByPrimaryKey(Serializable primaryKey)
327         throws SystemException {
328         return fetchByPrimaryKey(((Long)primaryKey).longValue());
329     }
330 
331     public RatingsStats fetchByPrimaryKey(long statsId)
332         throws SystemException {
333         RatingsStats ratingsStats = (RatingsStats)EntityCacheUtil.getResult(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
334                 RatingsStatsImpl.class, statsId, this);
335 
336         if (ratingsStats == null) {
337             Session session = null;
338 
339             try {
340                 session = openSession();
341 
342                 ratingsStats = (RatingsStats)session.get(RatingsStatsImpl.class,
343                         new Long(statsId));
344             }
345             catch (Exception e) {
346                 throw processException(e);
347             }
348             finally {
349                 if (ratingsStats != null) {
350                     cacheResult(ratingsStats);
351                 }
352 
353                 closeSession(session);
354             }
355         }
356 
357         return ratingsStats;
358     }
359 
360     public RatingsStats findByC_C(long classNameId, long classPK)
361         throws NoSuchStatsException, SystemException {
362         RatingsStats ratingsStats = fetchByC_C(classNameId, classPK);
363 
364         if (ratingsStats == null) {
365             StringBundler msg = new StringBundler(6);
366 
367             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
368 
369             msg.append("classNameId=");
370             msg.append(classNameId);
371 
372             msg.append(", classPK=");
373             msg.append(classPK);
374 
375             msg.append(StringPool.CLOSE_CURLY_BRACE);
376 
377             if (_log.isWarnEnabled()) {
378                 _log.warn(msg.toString());
379             }
380 
381             throw new NoSuchStatsException(msg.toString());
382         }
383 
384         return ratingsStats;
385     }
386 
387     public RatingsStats fetchByC_C(long classNameId, long classPK)
388         throws SystemException {
389         return fetchByC_C(classNameId, classPK, true);
390     }
391 
392     public RatingsStats fetchByC_C(long classNameId, long classPK,
393         boolean retrieveFromCache) throws SystemException {
394         Object[] finderArgs = new Object[] {
395                 new Long(classNameId), new Long(classPK)
396             };
397 
398         Object result = null;
399 
400         if (retrieveFromCache) {
401             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C,
402                     finderArgs, this);
403         }
404 
405         if (result == null) {
406             Session session = null;
407 
408             try {
409                 session = openSession();
410 
411                 StringBundler query = new StringBundler(3);
412 
413                 query.append(_SQL_SELECT_RATINGSSTATS_WHERE);
414 
415                 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
416 
417                 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
418 
419                 String sql = query.toString();
420 
421                 Query q = session.createQuery(sql);
422 
423                 QueryPos qPos = QueryPos.getInstance(q);
424 
425                 qPos.add(classNameId);
426 
427                 qPos.add(classPK);
428 
429                 List<RatingsStats> list = q.list();
430 
431                 result = list;
432 
433                 RatingsStats ratingsStats = null;
434 
435                 if (list.isEmpty()) {
436                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
437                         finderArgs, list);
438                 }
439                 else {
440                     ratingsStats = list.get(0);
441 
442                     cacheResult(ratingsStats);
443 
444                     if ((ratingsStats.getClassNameId() != classNameId) ||
445                             (ratingsStats.getClassPK() != classPK)) {
446                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
447                             finderArgs, ratingsStats);
448                     }
449                 }
450 
451                 return ratingsStats;
452             }
453             catch (Exception e) {
454                 throw processException(e);
455             }
456             finally {
457                 if (result == null) {
458                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
459                         finderArgs, new ArrayList<RatingsStats>());
460                 }
461 
462                 closeSession(session);
463             }
464         }
465         else {
466             if (result instanceof List<?>) {
467                 return null;
468             }
469             else {
470                 return (RatingsStats)result;
471             }
472         }
473     }
474 
475     public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
476         throws SystemException {
477         Session session = null;
478 
479         try {
480             session = openSession();
481 
482             dynamicQuery.compile(session);
483 
484             return dynamicQuery.list();
485         }
486         catch (Exception e) {
487             throw processException(e);
488         }
489         finally {
490             closeSession(session);
491         }
492     }
493 
494     public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
495         int start, int end) throws SystemException {
496         Session session = null;
497 
498         try {
499             session = openSession();
500 
501             dynamicQuery.setLimit(start, end);
502 
503             dynamicQuery.compile(session);
504 
505             return dynamicQuery.list();
506         }
507         catch (Exception e) {
508             throw processException(e);
509         }
510         finally {
511             closeSession(session);
512         }
513     }
514 
515     public List<RatingsStats> findAll() throws SystemException {
516         return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
517     }
518 
519     public List<RatingsStats> findAll(int start, int end)
520         throws SystemException {
521         return findAll(start, end, null);
522     }
523 
524     public List<RatingsStats> findAll(int start, int end, OrderByComparator obc)
525         throws SystemException {
526         Object[] finderArgs = new Object[] {
527                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
528             };
529 
530         List<RatingsStats> list = (List<RatingsStats>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
531                 finderArgs, this);
532 
533         if (list == null) {
534             Session session = null;
535 
536             try {
537                 session = openSession();
538 
539                 StringBundler query = null;
540                 String sql = null;
541 
542                 if (obc != null) {
543                     query = new StringBundler(2 +
544                             (obc.getOrderByFields().length * 3));
545 
546                     query.append(_SQL_SELECT_RATINGSSTATS);
547 
548                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
549 
550                     sql = query.toString();
551                 }
552 
553                 sql = _SQL_SELECT_RATINGSSTATS;
554 
555                 Query q = session.createQuery(sql);
556 
557                 if (obc == null) {
558                     list = (List<RatingsStats>)QueryUtil.list(q, getDialect(),
559                             start, end, false);
560 
561                     Collections.sort(list);
562                 }
563                 else {
564                     list = (List<RatingsStats>)QueryUtil.list(q, getDialect(),
565                             start, end);
566                 }
567             }
568             catch (Exception e) {
569                 throw processException(e);
570             }
571             finally {
572                 if (list == null) {
573                     list = new ArrayList<RatingsStats>();
574                 }
575 
576                 cacheResult(list);
577 
578                 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
579 
580                 closeSession(session);
581             }
582         }
583 
584         return list;
585     }
586 
587     public void removeByC_C(long classNameId, long classPK)
588         throws NoSuchStatsException, SystemException {
589         RatingsStats ratingsStats = findByC_C(classNameId, classPK);
590 
591         remove(ratingsStats);
592     }
593 
594     public void removeAll() throws SystemException {
595         for (RatingsStats ratingsStats : findAll()) {
596             remove(ratingsStats);
597         }
598     }
599 
600     public int countByC_C(long classNameId, long classPK)
601         throws SystemException {
602         Object[] finderArgs = new Object[] {
603                 new Long(classNameId), new Long(classPK)
604             };
605 
606         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
607                 finderArgs, this);
608 
609         if (count == null) {
610             Session session = null;
611 
612             try {
613                 session = openSession();
614 
615                 StringBundler query = new StringBundler(3);
616 
617                 query.append(_SQL_COUNT_RATINGSSTATS_WHERE);
618 
619                 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
620 
621                 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
622 
623                 String sql = query.toString();
624 
625                 Query q = session.createQuery(sql);
626 
627                 QueryPos qPos = QueryPos.getInstance(q);
628 
629                 qPos.add(classNameId);
630 
631                 qPos.add(classPK);
632 
633                 count = (Long)q.uniqueResult();
634             }
635             catch (Exception e) {
636                 throw processException(e);
637             }
638             finally {
639                 if (count == null) {
640                     count = Long.valueOf(0);
641                 }
642 
643                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
644                     count);
645 
646                 closeSession(session);
647             }
648         }
649 
650         return count.intValue();
651     }
652 
653     public int countAll() throws SystemException {
654         Object[] finderArgs = new Object[0];
655 
656         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
657                 finderArgs, this);
658 
659         if (count == null) {
660             Session session = null;
661 
662             try {
663                 session = openSession();
664 
665                 Query q = session.createQuery(_SQL_COUNT_RATINGSSTATS);
666 
667                 count = (Long)q.uniqueResult();
668             }
669             catch (Exception e) {
670                 throw processException(e);
671             }
672             finally {
673                 if (count == null) {
674                     count = Long.valueOf(0);
675                 }
676 
677                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
678                     count);
679 
680                 closeSession(session);
681             }
682         }
683 
684         return count.intValue();
685     }
686 
687     public void afterPropertiesSet() {
688         String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
689                     com.liferay.portal.util.PropsUtil.get(
690                         "value.object.listener.com.liferay.portlet.ratings.model.RatingsStats")));
691 
692         if (listenerClassNames.length > 0) {
693             try {
694                 List<ModelListener<RatingsStats>> listenersList = new ArrayList<ModelListener<RatingsStats>>();
695 
696                 for (String listenerClassName : listenerClassNames) {
697                     listenersList.add((ModelListener<RatingsStats>)Class.forName(
698                             listenerClassName).newInstance());
699                 }
700 
701                 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
702             }
703             catch (Exception e) {
704                 _log.error(e);
705             }
706         }
707     }
708 
709     @BeanReference(name = "com.liferay.portlet.ratings.service.persistence.RatingsEntryPersistence")
710     protected com.liferay.portlet.ratings.service.persistence.RatingsEntryPersistence ratingsEntryPersistence;
711     @BeanReference(name = "com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence")
712     protected com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence ratingsStatsPersistence;
713     @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence")
714     protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
715     @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence")
716     protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
717     private static final String _SQL_SELECT_RATINGSSTATS = "SELECT ratingsStats FROM RatingsStats ratingsStats";
718     private static final String _SQL_SELECT_RATINGSSTATS_WHERE = "SELECT ratingsStats FROM RatingsStats ratingsStats WHERE ";
719     private static final String _SQL_COUNT_RATINGSSTATS = "SELECT COUNT(ratingsStats) FROM RatingsStats ratingsStats";
720     private static final String _SQL_COUNT_RATINGSSTATS_WHERE = "SELECT COUNT(ratingsStats) FROM RatingsStats ratingsStats WHERE ";
721     private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "ratingsStats.classNameId = ? AND ";
722     private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "ratingsStats.classPK = ?";
723     private static final String _ORDER_BY_ENTITY_ALIAS = "ratingsStats.";
724     private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No RatingsStats exists with the primary key ";
725     private static final String _NO_SUCH_ENTITY_WITH_KEY = "No RatingsStats exists with the key {";
726     private static Log _log = LogFactoryUtil.getLog(RatingsStatsPersistenceImpl.class);
727 }