Advertisement
ballchaichana

DocumentDAO

Sep 19th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.03 KB | None | 0 0
  1.     public List<DocumentDB> findByDateAndYearAndStatus2 (int month ,int year ,UserUidDB userUID,String status) {
  2.         List<DocumentDB> historyTotal = null;
  3.         try {
  4.  
  5.                 DAO.begin();
  6.                 historyTotal = (List<DocumentDB>) DAO.getEntityManager().createNamedQuery("getHistoryTotalByMonthAndYearAndStatus2")
  7.                         .setParameter("monthDoc", month)
  8.                         .setParameter("yearDoc", year)
  9.                         .setParameter("creator", userUID)
  10.                         .setParameter("status", status)
  11.                         .getResultList();
  12.  
  13.            
  14.         } catch (Exception e) {
  15.             logger.error("Invalid month/year loading with "+month+"/"+year+" : "+status , e);
  16.         } finally {
  17.             DAO.close();
  18.         }
  19.         return historyTotal;
  20.     }
  21.    
  22.     public List<DocumentDB> findByDateAndYearAndMonth (int date,int month ,int year ,UserUidDB userUID) {
  23.         List<DocumentDB> historyTotal = null;
  24.         try {
  25.  
  26.                 DAO.begin();
  27.                 historyTotal = (List<DocumentDB>) DAO.getEntityManager().createNamedQuery("getHistoryTotalByDateAndMonthAndYear")
  28.                         .setParameter("dateDoc", date)
  29.                         .setParameter("monthDoc", month)
  30.                         .setParameter("yearDoc", year)
  31.                         .setParameter("creator", userUID)
  32.                         .getResultList();
  33.  
  34.            
  35.         } catch (Exception e) {
  36.             logger.error("Invalid month/year loading with "+date+"/"+month+"/"+year , e);
  37.         } finally {
  38.             DAO.close();
  39.         }
  40.         return historyTotal;
  41.     }
  42.    
  43.    
  44.     public List<DocumentDB> findByDateAndYearAndMonthAndStatus (int date,int month ,int year ,UserUidDB userUID,String status) {
  45.         List<DocumentDB> historyTotal = null;
  46.         try {
  47.  
  48.                 DAO.begin();
  49.                 historyTotal = (List<DocumentDB>) DAO.getEntityManager().createNamedQuery("getHistoryTotalByDateAndMonthAndYearAndStatus")
  50.                         .setParameter("dateDoc", date)
  51.                         .setParameter("monthDoc", month)
  52.                         .setParameter("yearDoc", year)
  53.                         .setParameter("creator", userUID)
  54.                         .setParameter("status", status)
  55.                         .getResultList();
  56.  
  57.            
  58.         } catch (Exception e) {
  59.             logger.error("Invalid month/year loading with "+date+"/"+month+"/"+year +" : "+status , e);
  60.         } finally {
  61.             DAO.close();
  62.         }
  63.         return historyTotal;
  64.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement