001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.ratings.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.kernel.annotation.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.ModelListener;
037    import com.liferay.portal.service.persistence.BatchSessionUtil;
038    import com.liferay.portal.service.persistence.ResourcePersistence;
039    import com.liferay.portal.service.persistence.UserPersistence;
040    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
041    
042    import com.liferay.portlet.ratings.NoSuchStatsException;
043    import com.liferay.portlet.ratings.model.RatingsStats;
044    import com.liferay.portlet.ratings.model.impl.RatingsStatsImpl;
045    import com.liferay.portlet.ratings.model.impl.RatingsStatsModelImpl;
046    
047    import java.io.Serializable;
048    
049    import java.util.ArrayList;
050    import java.util.Collections;
051    import java.util.List;
052    
053    /**
054     * @author    Brian Wing Shun Chan
055     * @see       RatingsStatsPersistence
056     * @see       RatingsStatsUtil
057     * @generated
058     */
059    public class RatingsStatsPersistenceImpl extends BasePersistenceImpl<RatingsStats>
060            implements RatingsStatsPersistence {
061            public static final String FINDER_CLASS_NAME_ENTITY = RatingsStatsImpl.class.getName();
062            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
063                    ".List";
064            public static final FinderPath FINDER_PATH_FETCH_BY_C_C = new FinderPath(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
065                            RatingsStatsModelImpl.FINDER_CACHE_ENABLED,
066                            FINDER_CLASS_NAME_ENTITY, "fetchByC_C",
067                            new String[] { Long.class.getName(), Long.class.getName() });
068            public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
069                            RatingsStatsModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
070                            "countByC_C",
071                            new String[] { Long.class.getName(), Long.class.getName() });
072            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
073                            RatingsStatsModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
074                            "findAll", new String[0]);
075            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
076                            RatingsStatsModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
077                            "countAll", new String[0]);
078    
079            public void cacheResult(RatingsStats ratingsStats) {
080                    EntityCacheUtil.putResult(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
081                            RatingsStatsImpl.class, ratingsStats.getPrimaryKey(), ratingsStats);
082    
083                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
084                            new Object[] {
085                                    new Long(ratingsStats.getClassNameId()),
086                                    new Long(ratingsStats.getClassPK())
087                            }, ratingsStats);
088            }
089    
090            public void cacheResult(List<RatingsStats> ratingsStatses) {
091                    for (RatingsStats ratingsStats : ratingsStatses) {
092                            if (EntityCacheUtil.getResult(
093                                                    RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
094                                                    RatingsStatsImpl.class, ratingsStats.getPrimaryKey(),
095                                                    this) == null) {
096                                    cacheResult(ratingsStats);
097                            }
098                    }
099            }
100    
101            public void clearCache() {
102                    CacheRegistryUtil.clear(RatingsStatsImpl.class.getName());
103                    EntityCacheUtil.clearCache(RatingsStatsImpl.class.getName());
104                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
105                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
106            }
107    
108            public void clearCache(RatingsStats ratingsStats) {
109                    EntityCacheUtil.removeResult(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
110                            RatingsStatsImpl.class, ratingsStats.getPrimaryKey());
111    
112                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
113                            new Object[] {
114                                    new Long(ratingsStats.getClassNameId()),
115                                    new Long(ratingsStats.getClassPK())
116                            });
117            }
118    
119            public RatingsStats create(long statsId) {
120                    RatingsStats ratingsStats = new RatingsStatsImpl();
121    
122                    ratingsStats.setNew(true);
123                    ratingsStats.setPrimaryKey(statsId);
124    
125                    return ratingsStats;
126            }
127    
128            public RatingsStats remove(Serializable primaryKey)
129                    throws NoSuchModelException, SystemException {
130                    return remove(((Long)primaryKey).longValue());
131            }
132    
133            public RatingsStats remove(long statsId)
134                    throws NoSuchStatsException, SystemException {
135                    Session session = null;
136    
137                    try {
138                            session = openSession();
139    
140                            RatingsStats ratingsStats = (RatingsStats)session.get(RatingsStatsImpl.class,
141                                            new Long(statsId));
142    
143                            if (ratingsStats == null) {
144                                    if (_log.isWarnEnabled()) {
145                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + statsId);
146                                    }
147    
148                                    throw new NoSuchStatsException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
149                                            statsId);
150                            }
151    
152                            return remove(ratingsStats);
153                    }
154                    catch (NoSuchStatsException nsee) {
155                            throw nsee;
156                    }
157                    catch (Exception e) {
158                            throw processException(e);
159                    }
160                    finally {
161                            closeSession(session);
162                    }
163            }
164    
165            protected RatingsStats removeImpl(RatingsStats ratingsStats)
166                    throws SystemException {
167                    ratingsStats = toUnwrappedModel(ratingsStats);
168    
169                    Session session = null;
170    
171                    try {
172                            session = openSession();
173    
174                            if (ratingsStats.isCachedModel() || BatchSessionUtil.isEnabled()) {
175                                    Object staleObject = session.get(RatingsStatsImpl.class,
176                                                    ratingsStats.getPrimaryKeyObj());
177    
178                                    if (staleObject != null) {
179                                            session.evict(staleObject);
180                                    }
181                            }
182    
183                            session.delete(ratingsStats);
184    
185                            session.flush();
186                    }
187                    catch (Exception e) {
188                            throw processException(e);
189                    }
190                    finally {
191                            closeSession(session);
192                    }
193    
194                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
195    
196                    RatingsStatsModelImpl ratingsStatsModelImpl = (RatingsStatsModelImpl)ratingsStats;
197    
198                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
199                            new Object[] {
200                                    new Long(ratingsStatsModelImpl.getOriginalClassNameId()),
201                                    new Long(ratingsStatsModelImpl.getOriginalClassPK())
202                            });
203    
204                    EntityCacheUtil.removeResult(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
205                            RatingsStatsImpl.class, ratingsStats.getPrimaryKey());
206    
207                    return ratingsStats;
208            }
209    
210            public RatingsStats updateImpl(
211                    com.liferay.portlet.ratings.model.RatingsStats ratingsStats,
212                    boolean merge) throws SystemException {
213                    ratingsStats = toUnwrappedModel(ratingsStats);
214    
215                    boolean isNew = ratingsStats.isNew();
216    
217                    RatingsStatsModelImpl ratingsStatsModelImpl = (RatingsStatsModelImpl)ratingsStats;
218    
219                    Session session = null;
220    
221                    try {
222                            session = openSession();
223    
224                            BatchSessionUtil.update(session, ratingsStats, merge);
225    
226                            ratingsStats.setNew(false);
227                    }
228                    catch (Exception e) {
229                            throw processException(e);
230                    }
231                    finally {
232                            closeSession(session);
233                    }
234    
235                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
236    
237                    EntityCacheUtil.putResult(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
238                            RatingsStatsImpl.class, ratingsStats.getPrimaryKey(), ratingsStats);
239    
240                    if (!isNew &&
241                                    ((ratingsStats.getClassNameId() != ratingsStatsModelImpl.getOriginalClassNameId()) ||
242                                    (ratingsStats.getClassPK() != ratingsStatsModelImpl.getOriginalClassPK()))) {
243                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
244                                    new Object[] {
245                                            new Long(ratingsStatsModelImpl.getOriginalClassNameId()),
246                                            new Long(ratingsStatsModelImpl.getOriginalClassPK())
247                                    });
248                    }
249    
250                    if (isNew ||
251                                    ((ratingsStats.getClassNameId() != ratingsStatsModelImpl.getOriginalClassNameId()) ||
252                                    (ratingsStats.getClassPK() != ratingsStatsModelImpl.getOriginalClassPK()))) {
253                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
254                                    new Object[] {
255                                            new Long(ratingsStats.getClassNameId()),
256                                            new Long(ratingsStats.getClassPK())
257                                    }, ratingsStats);
258                    }
259    
260                    return ratingsStats;
261            }
262    
263            protected RatingsStats toUnwrappedModel(RatingsStats ratingsStats) {
264                    if (ratingsStats instanceof RatingsStatsImpl) {
265                            return ratingsStats;
266                    }
267    
268                    RatingsStatsImpl ratingsStatsImpl = new RatingsStatsImpl();
269    
270                    ratingsStatsImpl.setNew(ratingsStats.isNew());
271                    ratingsStatsImpl.setPrimaryKey(ratingsStats.getPrimaryKey());
272    
273                    ratingsStatsImpl.setStatsId(ratingsStats.getStatsId());
274                    ratingsStatsImpl.setClassNameId(ratingsStats.getClassNameId());
275                    ratingsStatsImpl.setClassPK(ratingsStats.getClassPK());
276                    ratingsStatsImpl.setTotalEntries(ratingsStats.getTotalEntries());
277                    ratingsStatsImpl.setTotalScore(ratingsStats.getTotalScore());
278                    ratingsStatsImpl.setAverageScore(ratingsStats.getAverageScore());
279    
280                    return ratingsStatsImpl;
281            }
282    
283            public RatingsStats findByPrimaryKey(Serializable primaryKey)
284                    throws NoSuchModelException, SystemException {
285                    return findByPrimaryKey(((Long)primaryKey).longValue());
286            }
287    
288            public RatingsStats findByPrimaryKey(long statsId)
289                    throws NoSuchStatsException, SystemException {
290                    RatingsStats ratingsStats = fetchByPrimaryKey(statsId);
291    
292                    if (ratingsStats == null) {
293                            if (_log.isWarnEnabled()) {
294                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + statsId);
295                            }
296    
297                            throw new NoSuchStatsException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
298                                    statsId);
299                    }
300    
301                    return ratingsStats;
302            }
303    
304            public RatingsStats fetchByPrimaryKey(Serializable primaryKey)
305                    throws SystemException {
306                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
307            }
308    
309            public RatingsStats fetchByPrimaryKey(long statsId)
310                    throws SystemException {
311                    RatingsStats ratingsStats = (RatingsStats)EntityCacheUtil.getResult(RatingsStatsModelImpl.ENTITY_CACHE_ENABLED,
312                                    RatingsStatsImpl.class, statsId, this);
313    
314                    if (ratingsStats == null) {
315                            Session session = null;
316    
317                            try {
318                                    session = openSession();
319    
320                                    ratingsStats = (RatingsStats)session.get(RatingsStatsImpl.class,
321                                                    new Long(statsId));
322                            }
323                            catch (Exception e) {
324                                    throw processException(e);
325                            }
326                            finally {
327                                    if (ratingsStats != null) {
328                                            cacheResult(ratingsStats);
329                                    }
330    
331                                    closeSession(session);
332                            }
333                    }
334    
335                    return ratingsStats;
336            }
337    
338            public RatingsStats findByC_C(long classNameId, long classPK)
339                    throws NoSuchStatsException, SystemException {
340                    RatingsStats ratingsStats = fetchByC_C(classNameId, classPK);
341    
342                    if (ratingsStats == null) {
343                            StringBundler msg = new StringBundler(6);
344    
345                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
346    
347                            msg.append("classNameId=");
348                            msg.append(classNameId);
349    
350                            msg.append(", classPK=");
351                            msg.append(classPK);
352    
353                            msg.append(StringPool.CLOSE_CURLY_BRACE);
354    
355                            if (_log.isWarnEnabled()) {
356                                    _log.warn(msg.toString());
357                            }
358    
359                            throw new NoSuchStatsException(msg.toString());
360                    }
361    
362                    return ratingsStats;
363            }
364    
365            public RatingsStats fetchByC_C(long classNameId, long classPK)
366                    throws SystemException {
367                    return fetchByC_C(classNameId, classPK, true);
368            }
369    
370            public RatingsStats fetchByC_C(long classNameId, long classPK,
371                    boolean retrieveFromCache) throws SystemException {
372                    Object[] finderArgs = new Object[] { classNameId, classPK };
373    
374                    Object result = null;
375    
376                    if (retrieveFromCache) {
377                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C,
378                                            finderArgs, this);
379                    }
380    
381                    if (result == null) {
382                            Session session = null;
383    
384                            try {
385                                    session = openSession();
386    
387                                    StringBundler query = new StringBundler(3);
388    
389                                    query.append(_SQL_SELECT_RATINGSSTATS_WHERE);
390    
391                                    query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
392    
393                                    query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
394    
395                                    String sql = query.toString();
396    
397                                    Query q = session.createQuery(sql);
398    
399                                    QueryPos qPos = QueryPos.getInstance(q);
400    
401                                    qPos.add(classNameId);
402    
403                                    qPos.add(classPK);
404    
405                                    List<RatingsStats> list = q.list();
406    
407                                    result = list;
408    
409                                    RatingsStats ratingsStats = null;
410    
411                                    if (list.isEmpty()) {
412                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
413                                                    finderArgs, list);
414                                    }
415                                    else {
416                                            ratingsStats = list.get(0);
417    
418                                            cacheResult(ratingsStats);
419    
420                                            if ((ratingsStats.getClassNameId() != classNameId) ||
421                                                            (ratingsStats.getClassPK() != classPK)) {
422                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
423                                                            finderArgs, ratingsStats);
424                                            }
425                                    }
426    
427                                    return ratingsStats;
428                            }
429                            catch (Exception e) {
430                                    throw processException(e);
431                            }
432                            finally {
433                                    if (result == null) {
434                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
435                                                    finderArgs, new ArrayList<RatingsStats>());
436                                    }
437    
438                                    closeSession(session);
439                            }
440                    }
441                    else {
442                            if (result instanceof List<?>) {
443                                    return null;
444                            }
445                            else {
446                                    return (RatingsStats)result;
447                            }
448                    }
449            }
450    
451            public List<RatingsStats> findAll() throws SystemException {
452                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
453            }
454    
455            public List<RatingsStats> findAll(int start, int end)
456                    throws SystemException {
457                    return findAll(start, end, null);
458            }
459    
460            public List<RatingsStats> findAll(int start, int end,
461                    OrderByComparator orderByComparator) throws SystemException {
462                    Object[] finderArgs = new Object[] {
463                                    String.valueOf(start), String.valueOf(end),
464                                    String.valueOf(orderByComparator)
465                            };
466    
467                    List<RatingsStats> list = (List<RatingsStats>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
468                                    finderArgs, this);
469    
470                    if (list == null) {
471                            Session session = null;
472    
473                            try {
474                                    session = openSession();
475    
476                                    StringBundler query = null;
477                                    String sql = null;
478    
479                                    if (orderByComparator != null) {
480                                            query = new StringBundler(2 +
481                                                            (orderByComparator.getOrderByFields().length * 3));
482    
483                                            query.append(_SQL_SELECT_RATINGSSTATS);
484    
485                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
486                                                    orderByComparator);
487    
488                                            sql = query.toString();
489                                    }
490                                    else {
491                                            sql = _SQL_SELECT_RATINGSSTATS;
492                                    }
493    
494                                    Query q = session.createQuery(sql);
495    
496                                    if (orderByComparator == null) {
497                                            list = (List<RatingsStats>)QueryUtil.list(q, getDialect(),
498                                                            start, end, false);
499    
500                                            Collections.sort(list);
501                                    }
502                                    else {
503                                            list = (List<RatingsStats>)QueryUtil.list(q, getDialect(),
504                                                            start, end);
505                                    }
506                            }
507                            catch (Exception e) {
508                                    throw processException(e);
509                            }
510                            finally {
511                                    if (list == null) {
512                                            list = new ArrayList<RatingsStats>();
513                                    }
514    
515                                    cacheResult(list);
516    
517                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
518    
519                                    closeSession(session);
520                            }
521                    }
522    
523                    return list;
524            }
525    
526            public void removeByC_C(long classNameId, long classPK)
527                    throws NoSuchStatsException, SystemException {
528                    RatingsStats ratingsStats = findByC_C(classNameId, classPK);
529    
530                    remove(ratingsStats);
531            }
532    
533            public void removeAll() throws SystemException {
534                    for (RatingsStats ratingsStats : findAll()) {
535                            remove(ratingsStats);
536                    }
537            }
538    
539            public int countByC_C(long classNameId, long classPK)
540                    throws SystemException {
541                    Object[] finderArgs = new Object[] { classNameId, classPK };
542    
543                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
544                                    finderArgs, this);
545    
546                    if (count == null) {
547                            Session session = null;
548    
549                            try {
550                                    session = openSession();
551    
552                                    StringBundler query = new StringBundler(3);
553    
554                                    query.append(_SQL_COUNT_RATINGSSTATS_WHERE);
555    
556                                    query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
557    
558                                    query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
559    
560                                    String sql = query.toString();
561    
562                                    Query q = session.createQuery(sql);
563    
564                                    QueryPos qPos = QueryPos.getInstance(q);
565    
566                                    qPos.add(classNameId);
567    
568                                    qPos.add(classPK);
569    
570                                    count = (Long)q.uniqueResult();
571                            }
572                            catch (Exception e) {
573                                    throw processException(e);
574                            }
575                            finally {
576                                    if (count == null) {
577                                            count = Long.valueOf(0);
578                                    }
579    
580                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
581                                            count);
582    
583                                    closeSession(session);
584                            }
585                    }
586    
587                    return count.intValue();
588            }
589    
590            public int countAll() throws SystemException {
591                    Object[] finderArgs = new Object[0];
592    
593                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
594                                    finderArgs, this);
595    
596                    if (count == null) {
597                            Session session = null;
598    
599                            try {
600                                    session = openSession();
601    
602                                    Query q = session.createQuery(_SQL_COUNT_RATINGSSTATS);
603    
604                                    count = (Long)q.uniqueResult();
605                            }
606                            catch (Exception e) {
607                                    throw processException(e);
608                            }
609                            finally {
610                                    if (count == null) {
611                                            count = Long.valueOf(0);
612                                    }
613    
614                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
615                                            count);
616    
617                                    closeSession(session);
618                            }
619                    }
620    
621                    return count.intValue();
622            }
623    
624            public void afterPropertiesSet() {
625                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
626                                            com.liferay.portal.util.PropsUtil.get(
627                                                    "value.object.listener.com.liferay.portlet.ratings.model.RatingsStats")));
628    
629                    if (listenerClassNames.length > 0) {
630                            try {
631                                    List<ModelListener<RatingsStats>> listenersList = new ArrayList<ModelListener<RatingsStats>>();
632    
633                                    for (String listenerClassName : listenerClassNames) {
634                                            listenersList.add((ModelListener<RatingsStats>)InstanceFactory.newInstance(
635                                                            listenerClassName));
636                                    }
637    
638                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
639                            }
640                            catch (Exception e) {
641                                    _log.error(e);
642                            }
643                    }
644            }
645    
646            @BeanReference(type = RatingsEntryPersistence.class)
647            protected RatingsEntryPersistence ratingsEntryPersistence;
648            @BeanReference(type = RatingsStatsPersistence.class)
649            protected RatingsStatsPersistence ratingsStatsPersistence;
650            @BeanReference(type = ResourcePersistence.class)
651            protected ResourcePersistence resourcePersistence;
652            @BeanReference(type = UserPersistence.class)
653            protected UserPersistence userPersistence;
654            private static final String _SQL_SELECT_RATINGSSTATS = "SELECT ratingsStats FROM RatingsStats ratingsStats";
655            private static final String _SQL_SELECT_RATINGSSTATS_WHERE = "SELECT ratingsStats FROM RatingsStats ratingsStats WHERE ";
656            private static final String _SQL_COUNT_RATINGSSTATS = "SELECT COUNT(ratingsStats) FROM RatingsStats ratingsStats";
657            private static final String _SQL_COUNT_RATINGSSTATS_WHERE = "SELECT COUNT(ratingsStats) FROM RatingsStats ratingsStats WHERE ";
658            private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "ratingsStats.classNameId = ? AND ";
659            private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "ratingsStats.classPK = ?";
660            private static final String _ORDER_BY_ENTITY_ALIAS = "ratingsStats.";
661            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No RatingsStats exists with the primary key ";
662            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No RatingsStats exists with the key {";
663            private static Log _log = LogFactoryUtil.getLog(RatingsStatsPersistenceImpl.class);
664    }