List of usage examples for org.hibernate Query setCacheable
Query<R> setCacheable(boolean cacheable);
From source file:com.quix.aia.cn.imo.mapper.AddressBookMaintenance.java
License:Open Source License
/** * <p>//from w ww . j a v a 2s.co m * This method update Contract Details * <p> * * @param address code * @return AddressBook Class Object * */ public List<Object[]> getAddressBookSelectedField(String[] fetchFields, String[] conditionFieldName, String[] conditionFieldValue) { Session session = null; Query query = null; List<Object[]> list = null; try { session = HibernateFactory.openSession(); String fetchField = getStringFromArrayString(fetchFields, null, "forSelect"); String fetchCondition = getStringFromArrayString(conditionFieldName, conditionFieldValue, "forWhere"); query = session.createQuery(" SELECT " + fetchField + " FROM AddressBook WHERE " + fetchCondition); list = query.setCacheable(true).list(); } catch (Exception ex) { log.log(Level.SEVERE, ex.getMessage()); ex.printStackTrace(); ex.printStackTrace(); LogsMaintenance logsMain = new LogsMaintenance(); StringWriter errors = new StringWriter(); ex.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("AddressBookMaintenance", Level.SEVERE + "", errors.toString()); } finally { try { HibernateFactory.close(session); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); e.printStackTrace(); } session = null; } return list; }
From source file:com.quix.aia.cn.imo.mapper.AnnouncementMaintenance.java
License:Open Source License
/** * <p>Method is used to get all announcement for Rest service</p> * @return ArrayList of announcement/*from w w w. j a v a 2 s .c o m*/ */ public ArrayList getAnnouncementsRest(AamData aamData, String agentId) { log.log(Level.SEVERE, "AnnouncementMaintenance --> getAnnouncementsRest "); Session session = null; ArrayList announcementList = new ArrayList(); LogsMaintenance logsMain = new LogsMaintenance(); try { session = HibernateFactory.openSession(); Date sdate = new Date(); log.log(Level.SEVERE, "Start Time " + sdate.getTime()); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); Date now = new Date(); Query query = session.createQuery( "FROM Announcement where status = 1 and expDate >= :expDate and publishedDate <= :publishedDate and " + "( (buCode=:bucode and district=0) " + "or (buCode=:bucode and district=:distcode and branchCode=0)" + "or (buCode=:bucode and district=:distcode and branchCode=:branchCode and cityCode='0')" + "or (buCode=:bucode and district=:distcode and branchCode=:branchCode and cityCode=:citycode and sscCode='0')" + "or (buCode=:bucode and district=:distcode and branchCode=:branchCode and cityCode=:citycode and sscCode=:ssccode and officeCode='0')" + "or (buCode=:bucode and district=:distcode and branchCode=:branchCode and cityCode=:citycode and sscCode=:ssccode and officeCode =:officeCode ) )"); query.setParameter("expDate", sdf1.parse(sdf1.format(now))); query.setParameter("publishedDate", sdf1.parse(sdf1.format(now))); query.setParameter("bucode", aamData.getBuCode()); query.setParameter("distcode", aamData.getDistrictCode()); query.setParameter("branchCode", aamData.getBranchCode()); query.setParameter("citycode", aamData.getCity()); query.setParameter("ssccode", aamData.getSsc()); query.setParameter("officeCode", aamData.getOfficeCode()); announcementList = (ArrayList<Announcement>) query.setCacheable(true).list(); Date edate = new Date(); log.log(Level.SEVERE, "Total Time " + (edate.getTime() - sdate.getTime())); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); e.printStackTrace(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("AnnouncementMaintenance", Level.SEVERE + "", errors.toString()); } finally { try { HibernateFactory.close(session); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); e.printStackTrace(); } } return announcementList; }
From source file:com.quix.aia.cn.imo.mapper.AnnouncementMaintenance.java
License:Open Source License
/** * <p>Method is used to get all Deleted announcement for Rest service</p> * @return ArrayList of announcement/*w w w .ja va 2 s. co m*/ */ public ArrayList getDeletedAnnouncementsRest() { log.log(Level.SEVERE, "AnnouncementMaintenance --> getDeletedAnnouncementsRest "); Session session = null; ArrayList announcementList = new ArrayList(); LogsMaintenance logsMain = new LogsMaintenance(); try { session = HibernateFactory.openSession(); Date sdate = new Date(); log.log(Level.SEVERE, "Start Time " + sdate.getTime()); Query query = session.createQuery("SELECT annoucement_code FROM Announcement where status = 0"); announcementList = (ArrayList<Announcement>) query.setCacheable(true).list(); Date edate = new Date(); log.log(Level.SEVERE, "Total Time " + (edate.getTime() - sdate.getTime())); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); e.printStackTrace(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("AnnouncementMaintenance", Level.SEVERE + "", errors.toString()); } finally { try { HibernateFactory.close(session); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); e.printStackTrace(); } } return announcementList; }
From source file:com.quix.aia.cn.imo.mapper.EgreetingMaintenance.java
License:Open Source License
/** * <p>Method is used to get all Egreeting for Rest service</p> * @return ArrayList of Egreeting//from ww w .j a v a 2s. com */ public ArrayList getEgreetingRest(AamData aamData) { // TODO Auto-generated method stub log.log(Level.INFO, "EgreetingMaintenance --> getEgreetingRest "); Session session = null; ArrayList egreetingList = new ArrayList(); ArrayList<E_Greeting> list = new ArrayList<E_Greeting>(); LogsMaintenance logsMain = new LogsMaintenance(); try { session = HibernateFactory.openSession(); Date sdate = new Date(); log.log(Level.SEVERE, "Start Time " + sdate.getTime()); Query query = session.createQuery("FROM E_Greeting where status = 1 "); list = (ArrayList<E_Greeting>) query.setCacheable(true).list(); egreetingList.addAll(list); Date edate = new Date(); log.log(Level.SEVERE, "Total Time " + (edate.getTime() - sdate.getTime())); } catch (Exception e) { log.log(Level.SEVERE, "EgreetingMaintenance ---> getEgreetingRest ", e.getMessage()); e.printStackTrace(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("EgreetingMaintenance", Level.SEVERE + "", errors.toString()); } finally { try { HibernateFactory.close(session); } catch (Exception e) { log.log(Level.SEVERE, "EgreetingMaintenance ---> getEgreetingRest ", e.getMessage()); e.printStackTrace(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("EgreetingMaintenance", Level.SEVERE + "", errors.toString()); } } return egreetingList; }
From source file:com.quix.aia.cn.imo.mapper.EopMaintenance.java
License:Open Source License
/** * <p>Method is used to get all EOP for Rest service</p> * @param context //ww w . j av a 2s .c o m * @return ArrayList of EOP */ public ArrayList getAllEopRest(AamData aamData, String agentId, String candidateCode, ServletContext context) { // TODO Auto-generated method stub log.log(Level.SEVERE, "EopMaintenance --> getAllEopRest "); /*ResourceBundle msgProps = ResourceBundle.getBundle("configurations"); String appUrl=msgProps.getString("APP_URL");*/ Map<String, String> map = (Map<String, String>) context .getAttribute(ApplicationAttribute.CONFIGURATION_PROPERTIES_MAP); String appUrl = map.get("APP_URL"); Session session = null; ArrayList<Event> eopList = new ArrayList<Event>(); ArrayList<Event> eopList2 = new ArrayList<Event>(); List<EventCandidate> list1; Event event; try { session = HibernateFactory.openSession(); Date sdate = new Date(); log.log(Level.SEVERE, "Start Time " + sdate.getTime()); Criteria crit; Date now = new Date(); /* Query query=session.createQuery("FROM Event where status = 1 and eventDate >= :eventDate and " + "( (buCode=:bucode and district=0) " + "or (district=:distcode and branchCode=0)" + "or (branchCode=:branchCode and cityCode=0)" + "or (cityCode=:citycode and sscCode=0)" + "or (sscCode=:ssccode and officeCode = 0)" + "or (officeCode =:officeCode ) )");*/ Query query = session .createQuery("select distinct e FROM Event e,SpecialGroup s where status = 1 and e.openTo='SG'" + " AND (e.eventDate > :eventDate OR ( e.eventDate = :eventDate AND e.startTime > :startTime ))" + "and ( (e.buCode=:bucode and e.district=0) " + "or (e.buCode=:bucode and e.district=:distcode and e.branchCode=0)" + "or (e.buCode=:bucode and e.district=:distcode and e.branchCode=:branchCode and e.cityCode='0')" + "or (e.buCode=:bucode and e.district=:distcode and e.branchCode=:branchCode and e.cityCode=:citycode and e.sscCode='0')" + "or (e.buCode=:bucode and e.district=:distcode and e.branchCode=:branchCode and e.cityCode=:citycode and e.sscCode=:ssccode and e.officeCode = '0')" + "or (e.buCode=:bucode and e.district=:distcode and e.branchCode=:branchCode and e.cityCode=:citycode and e.sscCode=:ssccode and e.officeCode =:officeCode ) ) " + "and s.eventCode=e.event_code and s.agencyUnit=:leadcode) "); System.out.println("" + now); System.out.println("" + LMSUtil.HH_MM_SS.parse(LMSUtil.HH_MM_SS.format(now))); query.setParameter("startTime", LMSUtil.HH_MM_SS.parse(LMSUtil.HH_MM_SS.format(now))); query.setParameter("eventDate", sdf1.parse(sdf1.format(now))); query.setParameter("bucode", aamData.getBuCode()); query.setParameter("distcode", aamData.getDistrictCode()); query.setParameter("branchCode", aamData.getBranchCode()); query.setParameter("citycode", aamData.getCity()); query.setParameter("ssccode", aamData.getSsc()); query.setParameter("officeCode", aamData.getOfficeCode()); query.setParameter("leadcode", aamData.getAgentCode()); eopList = (ArrayList<Event>) query.setCacheable(true).list(); for (Iterator iterator = eopList.iterator(); iterator.hasNext();) { event = (Event) iterator.next(); if ("Y".equalsIgnoreCase(event.getOpenToRegistration())) event.setPublicUrl(appUrl + "FormManager?key=EopCandidateReg&type=NEW&eventCode=" + event.getEvent_code() + "&agentID="); else event.setPublicUrl(null); if (!"".equals(candidateCode)) { crit = session.createCriteria(EventCandidate.class); crit.add(Restrictions.eq("eventCode", event.getEvent_code())); crit.add(Restrictions.eq("eventCandidateCode", candidateCode)); crit.add(Restrictions.eq("status", true)); list1 = (ArrayList<EventCandidate>) crit.list(); if (!list1.isEmpty()) { event.setIsRegistered(true); } else { event.setIsRegistered(false); } } } query = session.createQuery("FROM Event where status = 1 and openTo!='SG'" + " AND (eventDate > :eventDate OR (eventDate = :eventDate AND startTime > :startTime ))" + " AND ( (buCode=:bucode and district=0) " + "or (buCode=:bucode and district=:distcode and branchCode=0)" + "or (buCode=:bucode and district=:distcode and branchCode=:branchCode and cityCode='0')" + "or (buCode=:bucode and district=:distcode and branchCode=:branchCode and cityCode=:citycode and sscCode='0')" + "or (buCode=:bucode and district=:distcode and branchCode=:branchCode and cityCode=:citycode and sscCode=:ssccode and officeCode = '0')" + "or (buCode=:bucode and district=:distcode and branchCode=:branchCode and cityCode=:citycode and sscCode=:ssccode and officeCode =:officeCode ) )"); System.out.println("" + now); query.setParameter("startTime", LMSUtil.HH_MM_SS.parse(LMSUtil.HH_MM_SS.format(now))); query.setParameter("eventDate", sdf1.parse(sdf1.format(now))); query.setParameter("bucode", aamData.getBuCode()); query.setParameter("distcode", aamData.getDistrictCode()); query.setParameter("branchCode", aamData.getBranchCode()); query.setParameter("citycode", aamData.getCity()); query.setParameter("ssccode", aamData.getSsc()); query.setParameter("officeCode", aamData.getOfficeCode()); eopList2 = (ArrayList<Event>) query.setCacheable(true).list(); for (Iterator iterator = eopList2.iterator(); iterator.hasNext();) { event = (Event) iterator.next(); if ("Y".equalsIgnoreCase(event.getOpenToRegistration())) event.setPublicUrl(appUrl + "FormManager?key=EopCandidateReg&type=NEW&eventCode=" + event.getEvent_code() + "&agentID="); else event.setPublicUrl(null); if (!"".equals(candidateCode)) { crit = session.createCriteria(EventCandidate.class); crit.add(Restrictions.eq("eventCode", event.getEvent_code())); crit.add(Restrictions.eq("eventCandidateCode", candidateCode)); crit.add(Restrictions.eq("status", true)); list1 = (ArrayList<EventCandidate>) crit.list(); if (!list1.isEmpty()) { event.setIsRegistered(true); } else { event.setIsRegistered(false); } } } eopList.addAll(eopList2); Date edate = new Date(); log.log(Level.SEVERE, "Total Time " + (edate.getTime() - sdate.getTime())); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); LogsMaintenance logsMain = new LogsMaintenance(); e.printStackTrace(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("EopMaintenance", Level.SEVERE + "", errors.toString()); } finally { try { HibernateFactory.close(session); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); e.printStackTrace(); } } return eopList; }
From source file:com.quix.aia.cn.imo.mapper.EopMaintenance.java
License:Open Source License
/** * <p>Method is used to get all Deleted EOP for Rest service</p> * @return ArrayList of EOP/*from w ww.j a v a 2s. c om*/ */ public ArrayList getAllDeletedEopRest() { // TODO Auto-generated method stub log.log(Level.SEVERE, "EopMaintenance --> getAllDeletedEopRest "); Session session = null; ArrayList eopList = new ArrayList(); try { session = HibernateFactory.openSession(); Date sdate = new Date(); log.log(Level.SEVERE, "Start Time " + sdate.getTime()); Query query = session.createQuery("SELECT event_code FROM Event where status = 0 "); eopList = (ArrayList<Event>) query.setCacheable(true).list(); Date edate = new Date(); log.log(Level.SEVERE, "Total Time " + (edate.getTime() - sdate.getTime())); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); LogsMaintenance logsMain = new LogsMaintenance(); e.printStackTrace(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("EopMaintenance", Level.SEVERE + "", errors.toString()); } finally { try { HibernateFactory.close(session); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); e.printStackTrace(); } } return eopList; }
From source file:com.quix.aia.cn.imo.mapper.EopMaintenance.java
License:Open Source License
/** * <p>Method is used to get all EOP for Rest service</p> * @return ArrayList of EOP//from ww w .j a va2s .c o m */ public ArrayList getAllEopRestPast(String agentId, String candidateCode, ServletContext context) { // TODO Auto-generated method stub log.log(Level.SEVERE, "EopMaintenance --> getAllEopRestPast "); Session session = null; ArrayList<Event> eopList = new ArrayList<Event>(); try { session = HibernateFactory.openSession(); Date sdate = new Date(); log.log(Level.SEVERE, "Start Time " + sdate.getTime()); Date now = new Date(); Query query = session.createQuery("select distinct e FROM Event e,EventCandidate ec where e.status = 1 " + " AND (e.eventDate < :eventDate OR ( e.eventDate = :eventDate AND e.startTime <= :startTime ))" + " AND ec.status = 1 AND ec.eventCode=e.event_code AND ec.eventCandidateCode = :candidateCode "); System.out.println("" + now); System.out.println("" + LMSUtil.HH_MM_SS.parse(LMSUtil.HH_MM_SS.format(now))); query.setParameter("startTime", LMSUtil.HH_MM_SS.parse(LMSUtil.HH_MM_SS.format(now))); query.setParameter("eventDate", sdf1.parse(sdf1.format(now))); query.setParameter("candidateCode", candidateCode); eopList = (ArrayList<Event>) query.setCacheable(true).list(); Date edate = new Date(); log.log(Level.SEVERE, "Total Time " + (edate.getTime() - sdate.getTime())); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); LogsMaintenance logsMain = new LogsMaintenance(); e.printStackTrace(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("EopMaintenance", Level.SEVERE + "", errors.toString()); } finally { try { HibernateFactory.close(session); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); e.printStackTrace(); } } return eopList; }
From source file:com.quix.aia.cn.imo.mapper.EopMaintenance.java
License:Open Source License
/** * <p>Method is used to get all EOP for particular Branch for Rest service</p> * @return ArrayList of EOP/* ww w . j ava2s . com*/ */ public ArrayList getAllEopBranchRest(String branchName) { // TODO Auto-generated method stub log.log(Level.SEVERE, "EopMaintenance --> getAllEopBranchRest "); Session session = null; ArrayList eopList = new ArrayList(); ArrayList<Event> list = new ArrayList<Event>(); List<Branch> branchList = new ArrayList<Branch>(); List<District> distList = new ArrayList<District>(); Event event; Branch branch = new Branch(); District dist = new District(); try { session = HibernateFactory.openSession(); Date sdate = new Date(); log.log(Level.SEVERE, "Start Time " + sdate.getTime()); Criteria crit = session.createCriteria(Branch.class); crit.add(Restrictions.eq("branchName", branchName)); crit.add(Restrictions.eq("status", true)); branchList = (ArrayList<Branch>) crit.list(); if (!branchList.isEmpty() && 0 < branchList.size()) { branch = branchList.get(0); crit = session.createCriteria(District.class); crit.add(Restrictions.eq("districtCode", branch.getDistCode())); crit.add(Restrictions.eq("status", true)); distList = (ArrayList<District>) crit.list(); dist = distList.get(0); } Query query = session.createQuery("FROM Event where status = 1 and " + "( (buCode=:bucode and district=0) " + "or (district=:distcode and branchCode=0)" + "or (branchCode =:branchCode and cityCode='0')" + " )"); query.setParameter("bucode", dist.getBuCode()); query.setParameter("distcode", dist.getDistrictCode()); query.setParameter("branchCode", branch.getBranchCode()); list = (ArrayList<Event>) query.setCacheable(true).list(); eopList.addAll(list); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); LogsMaintenance logsMain = new LogsMaintenance(); e.printStackTrace(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("EopMaintenance", Level.SEVERE + "", errors.toString()); } finally { try { HibernateFactory.close(session); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); e.printStackTrace(); } } return eopList; }
From source file:com.quix.aia.cn.imo.mapper.HolidayMaintenance.java
License:Open Source License
/** * <p>Method is used to get all Holiday for Rest service</p> * @return ArrayList of Holiday/* w w w . j a v a2 s .c om*/ */ public ArrayList getAllHolidayRest(AamData aamData, String agentId) { // TODO Auto-generated method stub log.log(Level.SEVERE, "HolidayMaintenance --> getAllHolidayRest "); Session session = null; ArrayList holidayList = new ArrayList(); ArrayList<Holiday> list = new ArrayList<Holiday>(); ArrayList<Bu> bulist = new ArrayList<Bu>(); ArrayList<District> distlist = new ArrayList<District>(); ArrayList<City> citylist = new ArrayList<City>(); ArrayList<Ssc> ssclist = new ArrayList<Ssc>(); try { session = HibernateFactory.openSession(); Date sdate = new Date(); log.log(Level.SEVERE, "Start Time " + sdate.getTime()); // Criteria crit = session.createCriteria(Ssc.class); // crit.add(Restrictions.eq("sscName", aamData.getSsc())); // crit.add(Restrictions.eq("status", true)); // ssclist=(ArrayList<Ssc>) crit.list(); // Ssc ssc=ssclist.get(0); // // Query query=session.createQuery("FROM City where status = 1 and cityCode=:citycode "); // query.setParameter("citycode", ssc.getCityCode()); // citylist=(ArrayList<City>) query.setCacheable(true).list(); // City city=citylist.get(0); // // query=session.createQuery("FROM District where status = 1 and districtCode=:distcode "); // query.setParameter("distcode", city.getBranchCode()); // distlist=(ArrayList<District>) query.setCacheable(true).list(); // District dist=distlist.get(0); // // query = session.createQuery("FROM Bu where status = 1 and buCode=:bucode "); // query.setParameter("bucode", dist.getBuCode()); // bulist=(ArrayList<Bu>) query.setCacheable(true).list(); // Bu bu=bulist.get(0); Query query = session.createQuery("FROM Holiday where status = 1 and buCode=:bucode and district=0 "); query.setParameter("bucode", aamData.getBuCode()); list = (ArrayList<Holiday>) query.setCacheable(true).list(); holidayList.addAll(list); query = session.createQuery("FROM Holiday where status = 1 and district=:distcode and branchCode=0 "); query.setParameter("distcode", aamData.getDistrictCode()); list = (ArrayList<Holiday>) query.setCacheable(true).list(); holidayList.addAll(list); query = session .createQuery("FROM Holiday where status = 1 and branchCode=:branchCode and cityCode=0 "); query.setParameter("branchCode", aamData.getBranchCode()); list = (ArrayList<Holiday>) query.setCacheable(true).list(); holidayList.addAll(list); query = session.createQuery("FROM Holiday where status = 1 and cityCode=:citycode and sscCode=0 "); query.setParameter("citycode", aamData.getCityCode()); list = (ArrayList<Holiday>) query.setCacheable(true).list(); holidayList.addAll(list); query = session.createQuery("FROM Holiday where status = 1 and sscCode=:ssccode "); query.setParameter("ssccode", aamData.getSscCode()); list = (ArrayList<Holiday>) query.setCacheable(true).list(); holidayList.addAll(list); Date edate = new Date(); log.log(Level.SEVERE, "Total Time " + (edate.getTime() - sdate.getTime())); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); e.printStackTrace(); } finally { try { HibernateFactory.close(session); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); e.printStackTrace(); } } return holidayList; }
From source file:com.quix.aia.cn.imo.mapper.InterviewMaintenance.java
License:Open Source License
/** * <p>Method is used to get all Interview for Rest service</p> * @return ArrayList of Interview/* w ww .j a v a2 s .c om*/ */ public ArrayList getAllInterviewRest(AamData aamData, String agentId, String candidateCode) { // TODO Auto-generated method stub log.log(Level.SEVERE, "InteriewMaintenance --> getAllInterviewRest "); Session session = null; ArrayList interviewList = new ArrayList(); List<InterviewCandidate> list1; Interview interview; try { session = HibernateFactory.openSession(); Date sdate = new Date(); log.log(Level.SEVERE, "Start Time " + sdate.getTime()); Criteria crit; Date now = new Date(); Query query = session.createQuery("FROM Interview where status = 1 " + " AND (interviewDate > :interviewDate OR ( interviewDate = :interviewDate AND StartTime > :startTime ))" + " AND ( (buCode=:bucode and district=0) " + "or (buCode=:bucode and district=:distcode and branchCode=0)" + "or (buCode=:bucode and district=:distcode and branchCode=:branchCode and cityCode='0')" + "or (buCode=:bucode and district=:distcode and branchCode=:branchCode and cityCode=:citycode and sscCode='0')" + "or (buCode=:bucode and district=:distcode and branchCode=:branchCode and cityCode=:citycode and sscCode=:ssccode and officeCode = '0')" + "or (buCode=:bucode and district=:distcode and branchCode=:branchCode and cityCode=:citycode and sscCode=:ssccode and officeCode =:officeCode ) )"); System.out.println("" + now); System.out.println("" + LMSUtil.HH_MM_SS.parse(LMSUtil.HH_MM_SS.format(now))); query.setParameter("startTime", LMSUtil.HH_MM_SS.parse(LMSUtil.HH_MM_SS.format(now))); query.setParameter("interviewDate", sdf1.parse(sdf1.format(now))); query.setParameter("bucode", aamData.getBuCode()); query.setParameter("distcode", aamData.getDistrictCode()); query.setParameter("branchCode", aamData.getBranchCode()); query.setParameter("citycode", aamData.getCity()); query.setParameter("ssccode", aamData.getSsc()); query.setParameter("officeCode", aamData.getOfficeCode()); interviewList = (ArrayList<Interview>) query.setCacheable(true).list(); if (!"".equals(candidateCode)) { for (Iterator iterator = interviewList.iterator(); iterator.hasNext();) { interview = (Interview) iterator.next(); crit = session.createCriteria(InterviewCandidate.class); crit.add(Restrictions.eq("interviewCode", interview.getInterview_code())); crit.add(Restrictions.eq("interviewCandidateCode", candidateCode)); crit.add(Restrictions.eq("status", true)); list1 = (ArrayList<InterviewCandidate>) crit.list(); if (!list1.isEmpty()) { interview.setIsRegistered(true); } else { interview.setIsRegistered(false); } } } Date edate = new Date(); log.log(Level.SEVERE, "Total Time " + (edate.getTime() - sdate.getTime())); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); e.printStackTrace(); LogsMaintenance logsMain = new LogsMaintenance(); StringWriter errors = new StringWriter(); e.printStackTrace(new PrintWriter(errors)); logsMain.insertLogs("InterViewMaintenance", Level.SEVERE + "", errors.toString()); } finally { try { HibernateFactory.close(session); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage()); e.printStackTrace(); } } return interviewList; }