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.RatingsEntry;
024 import com.liferay.portlet.ratings.model.impl.RatingsEntryImpl;
025 import com.liferay.util.dao.orm.CustomSQLUtil;
026
027 import java.util.List;
028
029
032 public class RatingsEntryFinderImpl extends BasePersistenceImpl<RatingsEntry>
033 implements RatingsEntryFinder {
034
035 public static String FIND_BY_U_C_C =
036 RatingsEntryFinder.class.getName() + ".findByU_C_C";
037
038 public List<RatingsEntry> findByU_C_C(
039 long userId, long classNameId, List<Long> classPKs)
040 throws SystemException {
041
042 Session session = null;
043
044 try {
045 session = openSession();
046
047 String sql = CustomSQLUtil.get(FIND_BY_U_C_C);
048
049 sql = StringUtil.replace(
050 sql, "[$CLASS_PKS$]", StringUtil.merge(classPKs));
051
052 SQLQuery q = session.createSQLQuery(sql);
053
054 q.addEntity("RatingsEntry", RatingsEntryImpl.class);
055
056 QueryPos qPos = QueryPos.getInstance(q);
057
058 qPos.add(userId);
059 qPos.add(classNameId);
060
061 return q.list();
062 }
063 catch (Exception e) {
064 throw new SystemException(e);
065 }
066 finally {
067 closeSession(session);
068 }
069 }
070
071 }