001
014
015 package com.liferay.portlet.ratings.service.persistence;
016
017 import com.liferay.portal.kernel.dao.orm.QueryPos;
018 import com.liferay.portal.kernel.dao.orm.SQLQuery;
019 import com.liferay.portal.kernel.dao.orm.Session;
020 import com.liferay.portal.kernel.exception.SystemException;
021 import com.liferay.portal.kernel.util.StringUtil;
022 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
023 import com.liferay.portlet.ratings.model.RatingsStats;
024 import com.liferay.portlet.ratings.model.impl.RatingsStatsImpl;
025 import com.liferay.util.dao.orm.CustomSQLUtil;
026
027 import java.util.List;
028
029
032 public class RatingsStatsFinderImpl extends BasePersistenceImpl<RatingsStats>
033 implements RatingsStatsFinder{
034
035 public static String FIND_BY_C_C =
036 RatingsStatsFinder.class.getName() + ".findByC_C";
037
038 public List<RatingsStats> findByC_C(long classNameId, List<Long> classPKs)
039 throws SystemException {
040
041 Session session = null;
042
043 try {
044 session = openSession();
045
046 String sql = CustomSQLUtil.get(FIND_BY_C_C);
047
048 sql = StringUtil.replace(
049 sql, "[$CLASS_PKS$]", StringUtil.merge(classPKs));
050
051 SQLQuery q = session.createSQLQuery(sql);
052
053 q.addEntity("RatingsStats", RatingsStatsImpl.class);
054
055 QueryPos qPos = QueryPos.getInstance(q);
056
057 qPos.add(classNameId);
058
059 return q.list();
060 }
061 catch (Exception e) {
062 throw new SystemException(e);
063 }
064 finally {
065 closeSession(session);
066 }
067 }
068
069 }