1 package org.kuali.student.r2.lum.lrc.dao; 2 3 import java.util.List; 4 import javax.persistence.NoResultException; 5 import javax.persistence.Query; 6 import org.kuali.student.r2.lum.lrc.model.ResultValueEntity; 7 import org.kuali.student.r2.common.dao.GenericEntityDao; 8 9 public class ResultValueDao extends GenericEntityDao<ResultValueEntity> { 10 11 public List<String> getIdsByType(String type) { 12 Query query = em.createNamedQuery("ResultValueEntity.getIdsByType"); 13 query.setParameter("type", type); 14 return query.getResultList(); 15 } 16 17 public List<ResultValueEntity> getByScale(String resultScaleKey) { 18 Query query = em.createNamedQuery("ResultValueEntity.getByScale"); 19 query.setParameter("resultScaleKey", resultScaleKey); 20 return query.getResultList(); 21 } 22 23 public ResultValueEntity getByScaleAndValue(String resultScaleKey, 24 String value) { 25 Query query = em.createNamedQuery("ResultValueEntity.getByScaleAndValue"); 26 query.setParameter("resultScaleKey", resultScaleKey); 27 query.setParameter("value", value); 28 try { 29 return (ResultValueEntity) query.getSingleResult(); 30 } catch (NoResultException ex) { 31 return null; 32 } 33 } 34 }