List of usage examples for org.hibernate Query setEntity
@Deprecated @SuppressWarnings("unchecked") Query<R> setEntity(String name, Object val);
From source file:org.egov.dao.recoveries.EgDeductionDetailsHibernateDAO.java
License:Open Source License
public EgDeductionDetails findEgDeductionDetailsForDeduAmt(final Recovery recovery, final EgPartytype egPartyType, final EgPartytype egPartySubType, final EgwTypeOfWork docType, final Date date) { EgDeductionDetails egDeductionDetails = null; session = getCurrentSession();//from w w w . ja v a 2 s . co m Query qry; final StringBuffer qryStr = new StringBuffer(); qryStr.append("from EgDeductionDetails ed where ed.recovery=:recovery "); if (null != egPartySubType) qryStr.append(" and ed.egpartytype =:egPartySubType "); if (null != docType) qryStr.append(" and ed.workDocType =:docType "); if (null != date) qryStr.append( " and ((ed.datefrom <=:date and ed.dateto>=:date and ed.dateto is not null) or (ed.datefrom<=:date and ed.dateto is null)) "); qry = session.createQuery(qryStr.toString()); if (null != recovery) qry.setEntity("recovery", recovery); if (null != egPartySubType) qry.setEntity("egPartySubType", egPartySubType); if (null != docType) qry.setEntity("docType", docType); if (null != date) qry.setDate("date", date); egDeductionDetails = (EgDeductionDetails) qry.uniqueResult(); return egDeductionDetails; }
From source file:org.egov.dao.recoveries.TdsHibernateDAO.java
License:Open Source License
public List<Recovery> getActiveTdsFilterBy(final String estimateDate, final BigDecimal estCost, final EgPartytype egPartytype, final EgwTypeOfWork egwTypeOfWork, final EgwTypeOfWork egwSubTypeOfWork) { Query qry; session = getCurrentSession();/*from ww w. j a va 2 s .co m*/ final StringBuffer qryStr = new StringBuffer(); List<Recovery> tdsList = null; qryStr.append("from Recovery tds where tds.isactive=true "); qry = session.createQuery(qryStr.toString()); if (egPartytype != null) { qryStr.append(" and tds.egPartytype=:egPartytype"); qry = session.createQuery(qryStr.toString()); } if (estCost != null) { qryStr.append( " and tds.id in (select ed.recovery.id from EgDeductionDetails ed where (ed.lowlimit<=:estCost and ed.highlimit>=:estCost and ed.highlimit is not null) or (ed.lowlimit<=:estCost and ed.highlimit is null)) "); qry = session.createQuery(qryStr.toString()); } if (estimateDate != null && !estimateDate.equals("")) { qryStr.append( " and tds.id in (select ed.recovery.id from EgDeductionDetails ed where (ed.datefrom<=:estimateDate and ed.dateto>=:estimateDate and ed.dateto is not null) or(ed.datefrom<=:estimateDate and ed.dateto is null))"); qry = session.createQuery(qryStr.toString()); } if (egwTypeOfWork != null) { qryStr.append( " and tds.id in (select ed.recovery.id from EgDeductionDetails ed where ed.workDocType =:egwTypeOfWork)"); qry = session.createQuery(qryStr.toString()); } if (egwSubTypeOfWork != null) { qryStr.append( " and tds.id in (select ed.recovery.id from EgDeductionDetails ed where ed.workDocSubType =:egwSubTypeOfWork)"); qry = session.createQuery(qryStr.toString()); } qryStr.append(" order by upper(type)"); qry = session.createQuery(qryStr.toString()); if (estimateDate != null && !estimateDate.equals("")) qry.setString("estimateDate", estimateDate); if (estCost != null) qry.setBigDecimal("estCost", estCost); if (egPartytype != null) qry.setEntity("egPartytype", egPartytype); if (egwTypeOfWork != null) qry.setEntity("egwTypeOfWork", egwTypeOfWork); if (egwSubTypeOfWork != null) qry.setEntity("egwSubTypeOfWork", egwSubTypeOfWork); tdsList = qry.list(); return tdsList; }
From source file:org.egov.dao.recoveries.TdsHibernateDAO.java
License:Open Source License
public Recovery getTdsByTypeAndPartyType(final String type, final EgPartytype egPartytype) { session = getCurrentSession();/*w w w . j a v a 2 s . co m*/ final Query qry = session .createQuery("from Recovery tds where upper(tds.type) =:type and tds.egPartytype =:egPartytype"); qry.setString("type", type.toUpperCase().trim()); qry.setEntity("egPartytype", egPartytype); return (Recovery) qry.uniqueResult(); }
From source file:org.egov.deduction.dao.EgRemittanceDetailHibernateDAO.java
License:Open Source License
public List<EgRemittanceDetail> getEgRemittanceDetailByEgRmt(final EgRemittance egRmt) { final Query qry = getCurrentSession() .createQuery("from EgRemittanceDetail erd where erd.egRemittance =:egRmt"); qry.setEntity("egRmt", egRmt); return qry.list(); }
From source file:org.egov.deduction.dao.EgRemittanceDetailHibernateDAO.java
License:Open Source License
public EgRemittanceDetail getEgRemittanceDetailFilterBy(final EgRemittance egRmt, final EgRemittanceGldtl egRmtGldtl) { final Query qry = getCurrentSession().createQuery( "from EgRemittanceDetail erd where erd.egRemittance =:egRmt and erd.egRemittanceGldtl =:egRmtGldtl"); qry.setEntity("egRmt", egRmt); qry.setEntity("egRmtGldtl", egRmtGldtl); return (EgRemittanceDetail) qry.uniqueResult(); }
From source file:org.egov.deduction.dao.EgRemittanceHibernateDAO.java
License:Open Source License
public List<EgRemittance> getEgRemittanceFilterBy(final Fund fund, final Recovery recovery, final String month, final CFinancialYear financialyear) { Query qry; final StringBuffer qryStr = new StringBuffer(); List<EgRemittance> egRemittanceList = null; qryStr.append(//from www . ja v a2s .com "From EgRemittance rmt where rmt.voucherheader.type='Payment' and rmt.voucherheader.status=0"); qry = getCurrentSession().createQuery(qryStr.toString()); if (fund != null) { qryStr.append(" and (rmt.fund = :fund)"); qry = getCurrentSession().createQuery(qryStr.toString()); } if (recovery != null) { qryStr.append(" and (rmt.tds = :recovery)"); qry = getCurrentSession().createQuery(qryStr.toString()); } if (month != null) { qryStr.append(" and (rmt.month = :month)"); qry = getCurrentSession().createQuery(qryStr.toString()); } if (financialyear != null) { qryStr.append(" and (rmt.financialyear =:financialyear)"); qry = getCurrentSession().createQuery(qryStr.toString()); } qryStr.append(" order by upper(rmt.tds.type)"); qry = getCurrentSession().createQuery(qryStr.toString()); if (fund != null) qry.setEntity("fund", fund); if (recovery != null) qry.setEntity("recovery", recovery); if (month != null) qry.setString("month", month); if (financialyear != null) qry.setEntity("financialyear", financialyear); if (LOGGER.isDebugEnabled()) LOGGER.debug("qryStr " + qryStr.toString()); egRemittanceList = qry.list(); return egRemittanceList; }
From source file:org.egov.demand.dao.DemandGenericHibDao.java
License:Open Source License
/** * This method called getDemandReasonMasterByModule gets * List<EgDemandReasonMaster> objects. * * <p>//ww w.j a va 2 s . c om * This method returns List<EgDemandReasonMaster> objects for given module. * </p> * * @param org * .egov.infstr.commons.Module module. * * @return List<EgDemandReasonMaster> objects. * * */ @Override public List<EgDemandReasonMaster> getDemandReasonMasterByModule(Module module) { List<EgDemandReasonMaster> list = new ArrayList<EgDemandReasonMaster>(); Query qry = null; if (module != null) { qry = getCurrentSession().createQuery(" from EgDemandReasonMaster where egModule =:module "); qry.setEntity("module", module); list = qry.list(); } return list; }
From source file:org.egov.demand.dao.DemandGenericHibDao.java
License:Open Source License
/** * This method called getDemandReasonMasterByCategoryAndModule gets * List<EgDemandReasonMaster> objects. * * <p>/*from w ww. ja v a2 s . c om*/ * This method returns List<EgDemandReasonMaster> objects for given * egReasonCategory and module. * </p> * * @param org * .egov.infstr.DCB.model.EgReasonCategory egReasonCategory. * * @param org * .egov.infstr.commons.Module module. * * @return List<EgDemandReasonMaster> objects. * * */ @Override public List<EgDemandReasonMaster> getDemandReasonMasterByCategoryAndModule(EgReasonCategory egReasonCategory, Module module) { List<EgDemandReasonMaster> list = new ArrayList<EgDemandReasonMaster>(); Query qry = null; if (egReasonCategory != null && module != null) { qry = getCurrentSession().createQuery( " from EgDemandReasonMaster where egModule =:module and egReasonCategory =:egReasonCategory "); qry.setEntity("module", module); qry.setEntity("egReasonCategory", egReasonCategory); list = qry.list(); } return list; }
From source file:org.egov.demand.dao.DemandGenericHibDao.java
License:Open Source License
/** * This method called getDemandReasonMasterByCode gets EgDemandReasonMaster * object./*w ww . j ava 2s .c o m*/ * * <p> * This method returns EgDemandReasonMaster object for given code and * module. * </p> * * @param java * .lang.Integer code. * * @param org * .egov.infstr.commons.Module module. * * @return EgDemandReasonMaster object. * * */ @Override public EgDemandReasonMaster getDemandReasonMasterByCode(String code, Module module) { EgDemandReasonMaster egDemandReasonMaster = null; Query qry = null; if (code != null && !code.equals("") && module != null) { qry = getCurrentSession().createQuery( " from EgDemandReasonMaster ReasonMaster where ReasonMaster.egModule =:module and ReasonMaster.code =:code "); qry.setEntity("module", module); qry.setString("code", code); egDemandReasonMaster = (EgDemandReasonMaster) qry.uniqueResult(); } return egDemandReasonMaster; }
From source file:org.egov.demand.dao.DemandGenericHibDao.java
License:Open Source License
/** * This method called getDemandReasonByInstallmentAndModule gets * List<EgDemandReason> objects.//w w w.ja v a2 s .c om * * <p> * This method returns List<EgDemandReason> objects for given * egReasonCategory and module. * </p> * * @param org * .egov.commons.Installment installment. * * @param org * .egov.infstr.commons.Module module. * * @return List<EgDemandReason> objects. * * */ @Override public List<EgDemandReason> getDemandReasonByInstallmentAndModule(Installment installment, Module module) { List<EgDemandReason> list = new ArrayList<EgDemandReason>(); Query qry = null; if (installment != null && module != null) { qry = getCurrentSession().createQuery( " select DmdReason from EgDemandReason DmdReason , EgDemandReasonMaster master where DmdReason.egDemandReasonMaster.id = master.id and master.egModule =:module and DmdReason.egInstallmentMaster =:installment "); qry.setEntity("module", module); qry.setEntity("installment", installment); list = qry.list(); } return list; }