List of usage examples for org.hibernate Query setDate
@Deprecated @SuppressWarnings("unchecked") default Query<R> setDate(String name, Date val)
From source file:org.egov.pims.service.EmployeeServiceImpl.java
License:Open Source License
/** * Api Used to get the report for employee,Retired,Deceased,Suspended based * on the dates. For Employed, Retired and Deceased, the employee's * assignment dates are considered. Whereas for Suspended status, the * Disciplinary Action details are considered. * //from w w w. ja v a2s .c o m * @param status * @param fromDate * @param toDate * @return List of Assignment * @throws Exception */ public List searchEmployee(Integer status, Date fromDate, Date toDate) throws Exception { List<Assignment> employeeList = new ArrayList<Assignment>(); String mainStr = ""; try { EgwStatus statusType = egwStatusHibernateDAO.findById(status, false); if (statusType.getModuletype().equals("Employee") && statusType.getDescription().equals("Employed")) { if (status.intValue() != 0) { mainStr = "from Assignment ev where ev.employee.StatusMaster.id =:employeeStatus"; } if (fromDate != null && toDate != null) { /* * mainStr += * " and ev.assignmentPrd.employeeId.dateOfFirstAppointment >= :fromDate " * + * " and ev.assignmentPrd.employeeId.dateOfFirstAppointment <= :toDate and ev.assignmentPrd.fromDate<=sysdate and ev.assignmentPrd.toDate >=sysdate" * ; */ // enhanced to avoid to show all assignment mainStr += " and ev.dateOfFirstAppointment >= :fromDate " + " and ev.dateOfFirstAppointment <= :toDate " + " and ((ev.fromDate<=sysdate and ev.toDate >=sysdate) " + " or (ev.fromDate in (select max(prd.fromDate) from Assignment prd where ev.employee.idPersonalInformation = prd.employee.idPersonalInformation " + " and not exists (select prd1.id from Assignment prd1 where prd1.employee.idPersonalInformation=ev.assignment.employee.idPersonalInformation " + " and ( prd1.dateOfFirstAppointment >= :fromDate and prd1.dateOfFirstAppointment <= :toDate and prd1.fromDate<= sysdate and prd1.toDate >= sysdate) )))) "; } } else if (statusType.getModuletype().equals("Employee") && statusType.getDescription().equals("Retired")) { if (status.intValue() != 0) { mainStr = "from Assignment ev where ev.employee.StatusMaster.id =:employeeStatus"; } if (fromDate != null && toDate != null) { /* * mainStr += * " and ev.assignmentPrd.employeeId.retirementDate >= :fromDate " * + * " and ev.assignmentPrd.employeeId.retirementDate <= :toDate and ev.assignmentPrd.fromDate<=sysdate and ev.assignmentPrd.toDate >=sysdate" * ; */ // enhanced to avoid to show all assignment mainStr += " and ev.assignmentPrd.employeeId.retirementDate >= :fromDate " + " and ev.employee.retirementDate <= :toDate " + " and ((ev.fromDate<=sysdate and ev.toDate >=sysdate) " + " or (ev.fromDate in (select max(prd.fromDate) from Assignment prd where ev.employee.idPersonalInformation = prd.employee.idPersonalInformation " + " and not exists (select prd1.id from Assignment prd1 where prd1.employee.idPersonalInformation=ev.employee.idPersonalInformation " + " and ( prd1.employee.retirementDate >= :fromDate and prd1.employee.retirementDate <= :toDate and prd1.fromDate<= sysdate and prd1.toDate >= sysdate) )))) "; } } else if (statusType.getModuletype().equals("Employee") && statusType.getDescription().equals("Deceased")) { if (status.intValue() != 0) { mainStr = "from Assignment ev where ev.employee.StatusMaster.id =:employeeStatus"; } if (fromDate != null && toDate != null) { // enhanced to avoid to show all assignment mainStr += " and ev.employee.deathDate >= :fromDate " + " and ev.employee.deathDate <= :toDate " + " and ((ev.fromDate<=sysdate and ev.toDate >=sysdate) " + " or (ev.fromDate in (select max(prd.fromDate) from Assignment prd where ev.employee.idPersonalInformation = prd.employee.idPersonalInformation " + " and not exists (select prd1.id from Assignment prd1 where prd1.employee.idPersonalInformation=ev.employee.idPersonalInformation " + " and ( prd1.employee.deathDate >= :fromDate and prd1.employee.deathDate <= :toDate and prd1.fromDate<= sysdate and prd1.toDate >= sysdate) )))) "; } } // to be handled /* * else if(statusType.getModuletype().equals("Employee") && * statusType.getDescription().equals("Suspended")) { * if(status.intValue() != 0) { mainStr = * "from Assignment ev where ev.employee.StatusMaster.id =:employeeStatus" * ; } if(fromDate != null && toDate!=null) { mainStr += * " and ev.employee.idPersonalInformation in " + * "(select D.employee.idPersonalInformation from DisciplinaryPunishment D where " * + * " D.dateOfSuspension >= :fromDate and D.dateOfSuspension <= :toDate ) " * ; } } */ Query qry = null; qry = getCurrentSession().createQuery(mainStr); logger.info("Query----" + qry.toString()); if (status.intValue() != 0) { qry.setInteger("employeeStatus", status); } if (fromDate != null) { qry.setDate("fromDate", new java.sql.Date(fromDate.getTime())); } if (toDate != null) { qry.setDate("toDate", new java.sql.Date(toDate.getTime())); } employeeList = (List) qry.list(); } catch (HibernateException he) { throw new ApplicationRuntimeException("Exception:" + he.getMessage(), he); } catch (Exception he) { throw new ApplicationRuntimeException("Exception:" + he.getMessage(), he); } return employeeList; }
From source file:org.egov.pims.service.SearchPositionService.java
License:Open Source License
/** * // w ww .j av a 2s.com * @param beginsWith * @param desId * @param deptId * @param jurdId * @param roleId * @param userDate * @param maxResults - if -1 all results are returned. * @return * @throws NoSuchObjectException */ public List<EmployeeView> getPositionBySearchParameters(String beginsWith, Integer desId, Integer deptId, Long jurdId, Integer roleId, Date userDate, Integer maxResults) throws NoSuchObjectException { List<EmployeeView> posList = new ArrayList<EmployeeView>(); logger.debug("inside getPositionBySearchParameters method ***********" + desId); String searchQuery = ""; List userListInJur = null; String myBeginsWith = beginsWith; if (myBeginsWith == null) myBeginsWith = ""; if (jurdId != null) { PersonalInformationDAO personalDAO = new PersonalInformationHibernateDAO(); //userListInJur = personalDAO.getListOfUsersByBoundaryId(jurdId); } try { searchQuery = "Select EV from EmployeeView EV,Position P where " + "EV.position.id=P.id and " + "trim(upper(P.name)) like '" + myBeginsWith.trim().toUpperCase() + "%' and " + " ((EV.toDate IS NULL AND EV.fromDate <= :userDate)OR(EV.fromDate <= :userDate AND EV.toDate >= :userDate))and EV.userActive ='1'"; //Jurisdiction J,JurisdictionValues JurVal, if (userListInJur != null && !userListInJur.isEmpty()) { /*searchQuery+=" and EV.userMaster.allJurisdictions.id in (Select J.id from Jurisdiction J,JurisdictionValues JurVal " + " where JurVal.boundary in (:bndryObjList) and JurVal.userJurLevel.id=J.id and " + "J.user.id = EV.userMaster.id and JurVal.isHistory='N' and (" + "(JurVal.toDate IS NULL and JurVal.fromDate <= :userDate) " + "OR " + "(JurVal.fromDate <= :userDate and JurVal.toDate >= :userDate))) " ;*/ searchQuery += "and EV.userMaster in (:bndryObjList) "; } if (desId != null && desId.intValue() != 0) searchQuery += " and EV.designation.id = :desId "; if (deptId != null && deptId.intValue() != 0) searchQuery += " and EV.department.id= :deptId "; if (roleId != null && roleId != null) { //FIXME: add isHistory check searchQuery += " and EV.employee.id IN ( Select U.user.id from UserRole U where U.role.id=:roleId and U.isHistory='N'and " + "((U.toDate IS NULL AND U.fromDate <= :userDate)OR(U.fromDate <= :userDate AND U.toDate > :userDate)))"; //searchQuery +=" EV.userid = userrole.user and userrole.roleid = :roleId and userrole.from"; } Query query = getCurrentSession().createQuery(searchQuery); logger.info("quey >>>" + query.toString()); if (userListInJur != null && !userListInJur.isEmpty()) { query.setParameterList("bndryObjList", userListInJur); } if (desId != null && desId.intValue() != 0) { query.setInteger("desId", desId); } if (deptId != null && deptId.intValue() != 0) { query.setInteger("deptId", deptId); } if (userDate != null) { query.setDate("userDate", userDate); } if (roleId != null && roleId != null) { query.setInteger("roleId", roleId); } posList = (List) query.list(); } catch (HibernateException h) { throw new ApplicationRuntimeException("Exception:" + h.getMessage(), h); } return posList; }
From source file:org.egov.ptis.actions.bills.BillGenerationAction.java
License:Open Source License
@SuppressWarnings("unchecked") @Action(value = "/bills/billGeneration-billsGenStatus") public String billsGenStatus() { ReportInfo reportInfo;/* www . j a v a 2s . co m*/ Integer totalProps = 0; Integer totalBillsGen = 0; final Installment currInst = installmentDAO .getInsatllmentByModuleForGivenDate(ptBillServiceImpl.getModule(), new Date()); final StringBuilder propQueryString = new StringBuilder(); propQueryString.append("select bndry.boundaryNum,bndry.name, count(bndry.boundaryNum) ").append( "from Boundary bndry, PropertyID pid left join pid.basicProperty bp where bp.upicNo is not null and bp.active = true and ") .append("bp.source = 'M' and pid.ward.id = bndry.id ") .append("and bp.id not in (select basicProperty from PropertyStatusValues group by basicProperty having count(basicProperty) > 0 ) ") .append(" and bp.id in (select basicProperty from PropertyImpl where status = 'A' and isExemptedFromTax = false ) ") .append("group by bndry.name, bndry.boundaryNum ").append("order by bndry.boundaryNum, bndry.name"); final Query billQuery = getPersistenceService().getSession().getNamedQuery(QUERY_DEMAND_BILL_STATUS); billQuery.setDate("FromDate", currInst.getFromDate()); billQuery.setDate("ToDate", currInst.getToDate()); final List<Object> billList = billQuery.list(); LOGGER.info("billList : " + billList); final Query propQuery = getPersistenceService().getSession().createQuery(propQueryString.toString()); final List<Object> propList = propQuery.list(); LOGGER.info("propList : " + propList); for (final Object props : propList) { reportInfo = new ReportInfo(); final Object[] propObj = (Object[]) props; reportInfo.setWardNo(String.valueOf(propObj[0]) + '-' + String.valueOf(propObj[1])); reportInfo.setTotalNoProps(Integer.valueOf(((Long) propObj[2]).toString())); reportInfo.setTotalGenBills(0); String propWardNo = String.valueOf(propObj[0]); String wardNo; for (final Object bills : billList) { final Object[] billObj = (Object[]) bills; wardNo = String.valueOf(billObj[0]); if (propWardNo.equals(wardNo)) { reportInfo.setTotalGenBills(Integer.valueOf(((Long) billObj[1]).toString())); break; } } totalProps = totalProps + reportInfo.getTotalNoProps(); totalBillsGen = totalBillsGen + reportInfo.getTotalGenBills(); getReportInfos().add(reportInfo); } final ReportInfo reportInfoCount = new ReportInfo(); reportInfoCount.setWardNo("Total :"); reportInfoCount.setTotalNoProps(totalProps); reportInfoCount.setTotalGenBills(totalBillsGen); getReportInfos().add(reportInfoCount); return STATUS_BILLGEN; }
From source file:org.egov.ptis.actions.bills.BillGenerationAction.java
License:Open Source License
@SuppressWarnings("unchecked") @Action(value = "/bills/billGeneration-billGenStatusByPartNo") public String billGenStatusByPartNo() { LOGGER.debug("Entered into billGenStatusByPartNo, wardNum=" + wardNum); ReportInfo reportInfo;/*www. java2 s . c om*/ Integer totalProps = 0; Integer totalBillsGen = 0; final Installment currInst = propertyTaxCommonUtils.getCurrentInstallment(); final StringBuilder billQueryString = new StringBuilder(); final StringBuilder propQueryString = new StringBuilder(); billQueryString.append("select bp.partNo, count(bp.partNo) ") .append("from EgBill bill, Boundary bndry, PtNotice notice left join notice.basicProperty bp ") .append("where bp.propertyID.ward.id=bndry.id ").append("and bndry.boundaryNum = :bndryNum ") .append("and bill.is_History = 'N' ").append("and :FromDate <= bill.issueDate ") .append("and :ToDate >= bill.issueDate ").append("and bill.egBillType.code = :BillType ") .append("and bill.billNo = notice.noticeNo ").append("and notice.noticeType = 'Bill' ") .append("and notice.fileStore is not null ").append("group by bp.partNo ") .append("order by bp.partNo"); propQueryString.append("select bp.partNo, count(bp.partNo) ") .append("from Boundary bndry, PropertyID pid left join pid.basicProperty bp ") .append("where bp.active = true and pid.ward.id = bndry.id ") .append("and bndry.boundaryNum = :bndryNum ").append("group by bp.partNo ") .append("order by bp.partNo"); final Query billQuery = getPersistenceService().getSession().createQuery(billQueryString.toString()); billQuery.setBigInteger("bndryNum", new BigInteger(wardNum)); billQuery.setDate("FromDate", currInst.getFromDate()); billQuery.setDate("ToDate", currInst.getToDate()); billQuery.setString("BillType", BILLTYPE_MANUAL); final List<Object> billList = billQuery.list(); final Query propQuery = getPersistenceService().getSession().createQuery(propQueryString.toString()); propQuery.setBigInteger("bndryNum", new BigInteger(wardNum)); final List<Object> propList = propQuery.list(); for (final Object props : propList) { reportInfo = new ReportInfo(); final Object[] propObj = (Object[]) props; reportInfo.setPartNo(String.valueOf(propObj[0])); reportInfo.setTotalNoProps(Integer.valueOf(((Long) propObj[1]).toString())); reportInfo.setTotalGenBills(0); String partNo; for (final Object bills : billList) { final Object[] billObj = (Object[]) bills; partNo = String.valueOf(billObj[0]); if (reportInfo.getPartNo().equals(partNo)) { reportInfo.setTotalGenBills(Integer.valueOf(((Long) billObj[1]).toString())); break; } } totalProps = totalProps + reportInfo.getTotalNoProps(); totalBillsGen = totalBillsGen + reportInfo.getTotalGenBills(); getReportInfos().add(reportInfo); } final ReportInfo reportInfoCount = new ReportInfo(); reportInfoCount.setPartNo("Total :"); reportInfoCount.setTotalNoProps(totalProps); reportInfoCount.setTotalGenBills(totalBillsGen); getReportInfos().add(reportInfoCount); LOGGER.debug("Exiting from billGenStatusByPartNo"); return STATUS_BILLGEN_BY_PARTNO; }
From source file:org.egov.ptis.actions.reports.DailyAbstractRecoveryReportAction.java
License:Open Source License
@SuppressWarnings("unchecked") private RecoveryInfo prepareReportData(StringBuffer qry, Calendar fDate, Calendar tDate) { RecoveryInfo recInfo = new RecoveryInfo(); Query sqlQry = persistenceService.getSession().createSQLQuery(qry.toString()); if (fDate != null) { recInfo.setFromDate(fDate.getTime()); sqlQry.setDate("fromDate", fDate.getTime()); }/*www . j a va 2 s. com*/ if (tDate != null) { recInfo.setToDate(tDate.getTime()); sqlQry.setDate("toDate", tDate.getTime()); } List<Object[]> currFinYearResList = sqlQry.list(); if (fDate != null) { fDate.add(Calendar.YEAR, -1); sqlQry.setDate("fromDate", fDate.getTime()); } if (tDate != null) { tDate.add(Calendar.YEAR, -1); sqlQry.setDate("toDate", tDate.getTime()); } List<Object[]> prevFinYearResList = sqlQry.list(); for (Object[] currFinYearRec : currFinYearResList) { recInfo.setGenTax(recInfo.getGenTax().add((BigDecimal) currFinYearRec[1])); recInfo.setFireTax(recInfo.getFireTax().add((BigDecimal) currFinYearRec[2])); recInfo.setWaterTax(recInfo.getWaterTax().add((BigDecimal) currFinYearRec[3])); recInfo.setSewerageTax(recInfo.getSewerageTax().add((BigDecimal) currFinYearRec[4])); recInfo.setLightTax(recInfo.getLightTax().add((BigDecimal) currFinYearRec[5])); recInfo.setEduCess(recInfo.getEduCess().add((BigDecimal) currFinYearRec[6])); recInfo.setBigBldgTax(recInfo.getBigBldgTax().add((BigDecimal) currFinYearRec[7])); recInfo.setEgsCess(recInfo.getEgsCess().add((BigDecimal) currFinYearRec[8])); } recInfo.setTotCurrYearColl(recInfo.getGenTax().add(recInfo.getFireTax()).add(recInfo.getWaterTax()) .add(recInfo.getSewerageTax()).add(recInfo.getLightTax()).add(recInfo.getEduCess()) .add(recInfo.getBigBldgTax()).add(recInfo.getEgsCess())); BigDecimal total = BigDecimal.ZERO; for (Object[] prevFinYearRec : prevFinYearResList) { total = total.add((BigDecimal) prevFinYearRec[1]).add((BigDecimal) prevFinYearRec[2]) .add((BigDecimal) prevFinYearRec[3]).add((BigDecimal) prevFinYearRec[4]) .add((BigDecimal) prevFinYearRec[5]).add((BigDecimal) prevFinYearRec[6]) .add((BigDecimal) prevFinYearRec[7]).add((BigDecimal) prevFinYearRec[8]); } recInfo.setTotPrevYearColl(total); return recInfo; }
From source file:org.egov.ptis.actions.reports.HeadWiseDmdNdRecReportAction.java
License:Open Source License
private void prepareReasonWiseArrDmdColl() { LOGGER.debug("Enter prepareReasonWiseArrDmdColl"); StringBuilder arrDmdCollBuilder = new StringBuilder(1500); arrDmdCollBuilder.append("select").append(" sum(dcb.generalTax), sum(dcb.generalTaxColl),") .append(" sum(dcb.egsTax), sum(dcb.egsTaxColl), ") .append(" sum(dcb.eduCessResdTax) + sum(dcb.eduCessNonResdTax),") .append(" sum(dcb.eduCessResdTaxColl) + sum(dcb.eduCessNonResdTaxColl),") .append(" sum(dcb.waterTax), sum(dcb.waterTaxColl), sum(dcb.fireTax),") .append(" sum(dcb.fireTaxColl), sum(dcb.sewerageTax), sum(dcb.sewerageTaxColl),") .append(" sum(dcb.lightTax), sum(dcb.lightTaxColl), sum(dcb.bigBldgTax),") .append(" sum(dcb.bigBldgTaxColl), sum(dcb.chqBouncePenalty),") .append(" sum(dcb.chqBuncPnltyColl), sum(dcb.penaltyFine),").append(" sum(dcb.penaltyFineColl)") .append(" from InstDmdCollMaterializeView dcb, Installment inst, Module module").append(" where") .append(" inst.module.id = module.id").append(" and module.moduleName = 'Property Tax'") .append(" and inst.toDate < :currInstFromDate").append(" and dcb.installment.id = inst.id"); Query qry = getPersistenceService().getSession().createQuery(arrDmdCollBuilder.toString()); qry.setDate("currInstFromDate", currentInstallment.getFromDate()); arrInstDmdCollList = qry.list();/*w w w . ja v a2 s . c o m*/ Object[] arrearTaxes = (Object[]) arrInstDmdCollList.get(0); dmdCollMap.put("arrSewerageTax", (BigDecimal) arrearTaxes[10]); dmdCollMap.put("arrWaterTax", (BigDecimal) arrearTaxes[6]); dmdCollMap.put("arrGenTax", (BigDecimal) arrearTaxes[0]); dmdCollMap.put("arrFireTax", (BigDecimal) arrearTaxes[8]); dmdCollMap.put("arrLightTax", (BigDecimal) arrearTaxes[12]); dmdCollMap.put("arrEduTax", (BigDecimal) arrearTaxes[4]); dmdCollMap.put("arrEgsTax", (BigDecimal) arrearTaxes[2]); dmdCollMap.put("arrBigBldgTax", (BigDecimal) arrearTaxes[14]); dmdCollMap.put("arrSewerageTaxColl", (BigDecimal) arrearTaxes[11]); dmdCollMap.put("arrWaterTaxColl", (BigDecimal) arrearTaxes[7]); dmdCollMap.put("arrGenTaxColl", (BigDecimal) arrearTaxes[1]); dmdCollMap.put("arrFireTaxColl", (BigDecimal) arrearTaxes[9]); dmdCollMap.put("arrLightTaxColl", (BigDecimal) arrearTaxes[13]); dmdCollMap.put("arrEduTaxColl", (BigDecimal) arrearTaxes[5]); dmdCollMap.put("arrEgsTaxColl", (BigDecimal) arrearTaxes[3]); dmdCollMap.put("arrBigBldgTaxColl", (BigDecimal) arrearTaxes[15]); dmdCollMap.put("arrChqBuncPenalty", (BigDecimal) arrearTaxes[16]); dmdCollMap.put("arrPenaltyFine", (BigDecimal) arrearTaxes[18]); dmdCollMap.put("arrChqBuncPnltyColl", (BigDecimal) arrearTaxes[17]); dmdCollMap.put("arrPenaltyFineColl", (BigDecimal) arrearTaxes[19]); for (Map.Entry<String, BigDecimal> mapEntry : dmdCollMap.entrySet()) { if (mapEntry.getKey().startsWith("arr")) { if (mapEntry.getKey().endsWith("Tax")) { arrDmdTotal = arrDmdTotal.add(mapEntry.getValue()); } else if (mapEntry.getKey().endsWith("Coll")) { arrCollTotal = arrCollTotal.add(mapEntry.getValue()); } } } arrDmdTotal = arrDmdTotal.add(dmdCollMap.get("arrChqBuncPenalty")).add(dmdCollMap.get("arrPenaltyFine")); arrDmdGrandTotal = arrDmdGrandTotal.add(arrDmdTotal); arrCollGrandTotal = arrCollGrandTotal.add(arrCollTotal); dmdCollMap.put("arrDmdTotal", arrDmdTotal); dmdCollMap.put("arrCollTotal", arrCollTotal); dmdCollMap.put("arrDmdGrandTotal", arrDmdGrandTotal); dmdCollMap.put("arrCollGrandTotal", arrCollGrandTotal); LOGGER.debug("Exit from prepareReasonWiseArrDmdColl"); }
From source file:org.egov.ptis.client.util.PropertyTaxUtil.java
License:Open Source License
public Map<String, Installment> getInstallmentsForCurrYear(final Date currDate) { final Map<String, Installment> currYearInstMap = new HashMap<>(); final String query = "select installment from Installment installment,CFinancialYear finYear where installment.module.name = '" + PTMODULENAME// w w w. j av a 2s. c o m + "' and (cast(:currDate as date)) between finYear.startingDate and finYear.endingDate " + " and cast(installment.fromDate as date) >= cast(finYear.startingDate as date) and cast(installment.toDate as date) <= cast(finYear.endingDate as date) order by installment.id "; final Query qry = persistenceService.getSession().createQuery(query); qry.setDate("currDate", currDate); final List<Installment> installments = qry.list(); currYearInstMap.put(CURRENTYEAR_FIRST_HALF, installments.get(0)); currYearInstMap.put(CURRENTYEAR_SECOND_HALF, installments.get(1)); return currYearInstMap; }
From source file:org.egov.ptis.domain.dao.demand.PtDemandHibernateDao.java
License:Open Source License
/** * This method returns current installment non-history EgptPtdemand * <p>//from www .java 2 s .c o m * This method returns EgptPtdemand Object for given property . * </p> * * @param org .egov.ptis.property.model.Property property * @return EgptPtdemand Object. */ @Override public Ptdemand getNonHistoryCurrDmdForProperty(final Property property) { Query qry = null; Ptdemand egptPtdemand = null; if (property != null) { final CFinancialYear currentFinancialYear = financialYearDAO.getFinancialYearByDate(new Date()); qry = getCurrentSession().createQuery( "from Ptdemand egptDem left join fetch egptDem.egDemandDetails dd left join fetch dd.egDemandReason dr " + "where egptDem.egptProperty =:property " + "and (egptDem.egInstallmentMaster.fromDate <= :fromYear and egptDem.egInstallmentMaster.toDate >=:toYear) and egptDem.isHistory='N' "); qry.setEntity(PROPERTY, property); qry.setDate("fromYear", currentFinancialYear.getStartingDate()); qry.setDate("toYear", currentFinancialYear.getStartingDate()); final List<Ptdemand> ptDemandResult = qry.list(); if (!ptDemandResult.isEmpty()) egptPtdemand = ptDemandResult.get(0); } return egptPtdemand; }
From source file:org.egov.ptis.domain.dao.property.BoundaryCategoryHibDao.java
License:Open Source License
@Override public Category getCategoryForBoundary(Boundary bndry) { Category category = null;/*from w ww . j ava 2s.c om*/ Query qry = null; if (bndry != null) { qry = getCurrentSession().createQuery( "select C from Category C inner join C.catBoundaries BC where BC.bndry = :bndry AND (" + "(BC.toDate IS NULL AND BC.fromDate <= :currDate) " + "OR " + "(BC.fromDate <= :currDate AND BC.toDate >= :currDate)) "); qry.setEntity(BOUNDARY, bndry); qry.setDate("currDate", new Date()); if (qry.list().size() == 1) category = (Category) qry.uniqueResult(); } return category; }
From source file:org.egov.ptis.domain.dao.property.BoundaryCategoryHibDao.java
License:Open Source License
@Override public Category getCategoryForBoundaryAndDate(Boundary bndry, Date date) { Category category = null;/*from w w w. java 2 s. co m*/ Query qry = null; if (bndry != null && date != null) { qry = getCurrentSession().createQuery( "select C from Category C inner join C.catBoundaries BC where BC.bndry = :bndry AND (" + "(BC.toDate IS NULL AND BC.fromDate <= :date) " + "OR " + "(BC.fromDate <= :date AND BC.toDate >= :date)) "); qry.setEntity(BOUNDARY, bndry); qry.setDate("date", date); if (qry.list().size() == 1) category = (Category) qry.uniqueResult(); } return category; }