List of usage examples for org.hibernate Query setEntity
@Deprecated @SuppressWarnings("unchecked") Query<R> setEntity(String name, Object val);
From source file:org.egov.commons.dao.InstallmentHibDao.java
License:Open Source License
@Override public List<Installment> getInstallmentsByModuleForGivenDateAndInstallmentType(final Module module, final Date installmentDate, final String installmentType) { final Query qry = getCurrentSession().createQuery( "from Installment I where I.module=:module and I.toDate >=:fromDate and I.toDate<=:tillDate and I.installmentType = :installmentType"); qry.setEntity("module", module); qry.setDate("fromDate", installmentDate); qry.setDate("tillDate", new Date()); qry.setString("installmentType", installmentType); return qry.list(); }
From source file:org.egov.commons.dao.InstallmentHibDao.java
License:Open Source License
@Override public List<Installment> getInstallmentsByModuleBetweenFromDateAndToDateAndInstallmentType(final Module module, final Date fromDate, final Date toDate, final String installmentType) { final Query qry = getCurrentSession().createQuery( "from Installment I where I.module=:module and I.toDate >=:fromDate and I.toDate<=:tillDate and I.installmentType = :installmentType"); qry.setEntity("module", module); qry.setDate("fromDate", fromDate); qry.setDate("tillDate", toDate); qry.setString("installmentType", installmentType); return qry.list(); }
From source file:org.egov.commons.dao.InstallmentHibDao.java
License:Open Source License
@Override public List<Installment> getInstallmentsByModuleBetweenFromDateAndToDate(final Module module, final Date fromDate, final Date toDate) { final Query qry = getCurrentSession().createQuery( "from Installment I where I.module=:module and I.toDate >=:fromDate and I.fromDate<=:tillDate"); qry.setEntity("module", module); qry.setDate("fromDate", fromDate); qry.setDate("tillDate", toDate); return qry.list(); }
From source file:org.egov.commons.dao.InstallmentHibDao.java
License:Open Source License
@Override public List<Installment> getInstallmentsByModuleAndFromDateAndInstallmentType(final Module module, final Date fromDate, final Date currentDate, final String installmentType) { final Query qry = getCurrentSession().createQuery( "from Installment I where I.module=:module and I.toDate >=:fromDate and I.fromDate<=:tillDate and I.installmentType = :installmentType"); qry.setEntity("module", module); qry.setDate("fromDate", fromDate); qry.setDate("tillDate", currentDate); qry.setString("installmentType", installmentType); return qry.list(); }
From source file:org.egov.commons.dao.InstallmentHibDao.java
License:Open Source License
@Override public List<Installment> fetchInstallments(final Module module, final Date toInstallmentDate, final int noOfInstallmentToFetch) { final Query qry = getCurrentSession().createQuery( "from Installment I where I.module=:module and I.installmentYear<=:installmentYear order by installmentYear desc"); qry.setEntity("module", module); qry.setDate("installmentYear", toInstallmentDate); qry.setMaxResults(noOfInstallmentToFetch); return qry.list(); }
From source file:org.egov.commons.dao.InstallmentHibDao.java
License:Open Source License
@Override public List<Installment> fetchPreviousInstallmentsInDescendingOrderByModuleAndDate(final Module module, final Date installmentDate, final int noOfInstallmentToFetch) { final Query qry = getCurrentSession().createQuery( "from Installment I where I.module=:module and I.toDate< :installmentDate order by fromDate desc"); qry.setEntity("module", module); qry.setDate("installmentDate", installmentDate); qry.setMaxResults(noOfInstallmentToFetch); return qry.list(); }
From source file:org.egov.commons.dao.InstallmentHibDao.java
License:Open Source License
@Override public List<Installment> fetchNextInstallmentsByModuleAndDate(final Module module, final Date date) { final Query qry = getCurrentSession().createQuery( "from Installment I where I.module=:module and I.fromDate>= :installmentDate order by fromDate desc"); qry.setEntity("module", module); qry.setDate("installmentDate", date); return qry.list(); }
From source file:org.egov.commons.dao.InstallmentHibDao.java
License:Open Source License
@Override public List<Installment> getInstallmentsByModuleAndInstallmentYearOrderByInstallmentYearDescending( final Module module, final int year) { final Query qry = getCurrentSession().createQuery( "from Installment I where I.module=:module and extract(year from I.installmentYear)=:year order by installment_year desc"); qry.setEntity("module", module); qry.setInteger("year", year); return qry.list(); }
From source file:org.egov.dao.recoveries.EgDeductionDetailsHibernateDAO.java
License:Open Source License
public List findByTds(final Recovery tds) { session = getCurrentSession();/*from w w w . j a v a2 s .c o m*/ final Query qry = session .createQuery("from EgDeductionDetails ded where ded.recovery=:tds order by ded.id"); qry.setEntity("tds", tds); return qry.list(); }
From source file:org.egov.dao.recoveries.EgDeductionDetailsHibernateDAO.java
License:Open Source License
public List<EgDeductionDetails> getEgDeductionDetailsFilterBy(final Recovery tds, final BigDecimal amount, final String date, final EgwTypeOfWork egwTypeOfWork, final EgwTypeOfWork egwSubTypeOfWork) { session = getCurrentSession();/*ww w. ja v a 2 s . com*/ Query qry; final StringBuffer qryStr = new StringBuffer(); List<EgDeductionDetails> egDeductionDetailsList = null; qryStr.append("from EgDeductionDetails ed where ed.recovery=:tds "); qry = session.createQuery(qryStr.toString()); if (amount != null) { qryStr.append( " and ((ed.lowlimit<=:amount and ed.highlimit>=:amount and ed.highlimit is not null) or (ed.lowlimit<=:amount and ed.highlimit is null)) "); qry = session.createQuery(qryStr.toString()); } if (date != null && !date.equals("")) { 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 (egwTypeOfWork != null) { qryStr.append(" and ed.workDocType =:egwTypeOfWork"); qry = session.createQuery(qryStr.toString()); } if (egwSubTypeOfWork != null) { qryStr.append(" and ed.workDocSubType =:egwSubTypeOfWork"); qry = session.createQuery(qryStr.toString()); } qryStr.append(" order by id"); qry = session.createQuery(qryStr.toString()); if (tds != null) qry.setEntity("tds", tds); if (date != null && !date.equals("")) qry.setString("date", date); if (amount != null) qry.setBigDecimal("amount", amount); if (egwTypeOfWork != null) qry.setEntity("egwTypeOfWork", egwTypeOfWork); if (egwSubTypeOfWork != null) qry.setEntity("egwSubTypeOfWork", egwSubTypeOfWork); egDeductionDetailsList = qry.list(); return egDeductionDetailsList; }