Advertisement
ballchaichana

DocumentDAO

Aug 20th, 2018
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. package th.in.oneauthen.object.DAO;
  2.  
  3. import java.util.List;
  4.  
  5. import org.apache.log4j.Logger;
  6.  
  7. import th.athichitsakul.dao.impl.StandardDAOImpl;
  8. import th.in.oneauthen.object.DocumentDB;
  9. import th.in.oneauthen.object.UserUidDB;
  10. import th.in.oneauthen.util.SystemLogger;
  11.  
  12. public class DocumentDAO extends StandardDAOImpl<DocumentDB>{
  13.  
  14.     private Logger logger = SystemLogger.generateSystemLogger(DocumentDAO.class);
  15.    
  16.     public DocumentDAO() {
  17.         super("esigning");
  18.     }
  19.    
  20.     public List<DocumentDB> findByUserUID ( UserUidDB userUID ) {
  21.         List<DocumentDB> history = null;
  22.         try {
  23. //          UserUidDB user = new UserUidDAO().find(userUID);;
  24. //          if ( user == null ) {
  25. //              logger.error("User not found with ID "+userUID);
  26. //          } else {
  27.                 DAO.begin();
  28.                 history = (List<DocumentDB>) DAO.getEntityManager().createNamedQuery("gethistoryByOwner")
  29.                         .setParameter("creator", userUID)
  30.                         .getResultList();
  31. //          }
  32.            
  33.         } catch (Exception e) {
  34.             logger.error("Invalid user loading with ID "+userUID , e);
  35.         } finally {
  36.             DAO.close();
  37.         }
  38.         return history;
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement