View Javadoc

1   package org.kuali.student.enrollment.class1.lpr.dao;
2   
3   import static javax.persistence.TemporalType.DATE;
4   
5   import java.util.Date;
6   import java.util.List;
7   
8   import org.kuali.student.enrollment.class1.lpr.model.LprTransactionEntity;
9   import org.kuali.student.r2.common.dao.GenericEntityDao;
10  import org.kuali.student.enrollment.lpr.dto.LprTransactionInfo;
11  import org.kuali.student.r2.common.exceptions.DoesNotExistException;
12  
13  public class LprTransactionDao extends GenericEntityDao<LprTransactionEntity> {
14  
15      public List<LprTransactionEntity> getByDate(Date searchDate) {
16          return em.createQuery("from AtpEntity a where :searchDate between a.startDate and a.endDate")
17                  .setParameter("searchDate", searchDate, DATE).getResultList();
18      }
19  
20      public List<LprTransactionEntity> getByDates(Date startDate, Date endDate) {
21          return em.createQuery("from AtpEntity a where a.startDate >= :startDate and a.endDate <= :endDate")
22                  .setParameter("startDate", startDate, DATE).setParameter("endDate", endDate).getResultList();
23      }
24      public LprTransactionEntity getByLprTransactionItemId(String lprTransactionItemId) {
25          return (LprTransactionEntity) ( em.createQuery("select distinct a from LprTransactionEntity a, IN (a.lprTransactionItems) item where item.id=:lprTransactionItemId")
26                  .setParameter("lprTransactionItemId", lprTransactionItemId).getSingleResult()) ;
27      }
28  
29  }