Example usage for org.hibernate Query setDate

List of usage examples for org.hibernate Query setDate

Introduction

In this page you can find the example usage for org.hibernate Query setDate.

Prototype

@Deprecated
@SuppressWarnings("unchecked")
default Query<R> setDate(String name, Date val) 

Source Link

Document

Bind the val (time is truncated) of a given Date object to a named query parameter.

Usage

From source file:org.egov.ptis.domain.dao.property.PropertyUsageHibernateDAO.java

License:Open Source License

/**
 * To get Property Usage by Usage Code/*www.  j a va  2 s .  c  o m*/
 * 
 * @param usageCode
 * @param fromDate
 * @return PropertyUsage
 * */
@Override
public PropertyUsage getPropertyUsage(String usageCode) {
    Query qry = getCurrentSession().createQuery(
            "from PropertyUsage PU where PU.usageCode = :usageCode AND PU.usageCode IS NOT NULL AND ("
                    + "(PU.toDate IS NULL AND PU.fromDate <= :currDate) " + "OR "
                    + "(PU.fromDate <= :currDate AND PU.toDate >= :currDate)) ");
    qry.setString("usageCode", usageCode);
    qry.setDate("currDate", new Date());
    return (PropertyUsage) qry.uniqueResult();
}

From source file:org.egov.ptis.domain.dao.property.PropertyUsageHibernateDAO.java

License:Open Source License

/**
 * To get Property Usage by Usage Code and From Date given
 * // www. j  ava2s  . c o m
 * @param usageCode
 * @param fromDate
 * @return PropertyUsage
 * */
@Override
public PropertyUsage getPropertyUsage(String usageCode, Date fromDate) {
    Query qry = getCurrentSession().createQuery(
            "from PropertyUsage PU where PU.usageCode = :usageCode AND PU.usageCode IS NOT NULL AND ("
                    + "(PU.toDate IS NULL AND PU.fromDate <= :fromDate) " + "OR "
                    + "(PU.fromDate <= :fromDate AND PU.toDate >= :fromDate)) ");
    qry.setString("usageCode", usageCode);
    qry.setDate("fromDate", fromDate);
    return (PropertyUsage) qry.uniqueResult();
}

From source file:org.egov.ptis.domain.dao.property.PropertyUsageHibernateDAO.java

License:Open Source License

/**
 * To get All Property Usages//from  w  w  w .  j  a  v  a2  s  . c om
 * 
 * @return List of PropertyUsages
 * */
@Override
public List<PropertyUsage> getAllPropertyUsage() {
    Query qry = getCurrentSession()
            .createQuery("from PropertyUsage PU where (" + "(PU.toDate IS NULL AND PU.fromDate <= :currDate) "
                    + "OR " + "(PU.fromDate <= :currDate AND PU.toDate >= :currDate))");
    qry.setDate("currDate", new Date());
    return qry.list();
}

From source file:org.egov.ptis.domain.dao.property.StructureClassificationHibernateDAO.java

License:Open Source License

/**
 * To get all StructuralClassification data
 * //w  w  w  .j a v  a 2  s .  c  o  m
 * @return {@link StructureClassification} List
 * */
@Override
public List getAllStructureClassification() {
    Query qry = getCurrentSession().createQuery(
            "FROM StructureClassification SC WHERE ((SC.toDate IS NULL AND SC.fromDate <= :currDate) "
                    + "OR (SC.fromDate <= :currDate AND SC.toDate >= :currDate))");
    qry.setDate("currDate", new Date());
    return qry.list();
}

From source file:org.egov.ptis.domain.dao.property.StructureClassificationHibernateDAO.java

License:Open Source License

/**
 * To get the construction cost by Construction Type Code, From Date and
 * Floor Number/* w ww  .  j av  a 2  s .com*/
 * 
 * @param constrTypeCode
 * @param fromDate
 * @param floorNum
 * @return {@link StructureClassification} StructureClassification
 **/
@Override
public StructureClassification getStructureClassification(String constrTypeCode, Date fromDate,
        Integer floorNum) {
    Query qry = getCurrentSession()
            .createQuery("FROM StructureClassification SC WHERE SC.constrTypeCode =:constrTypeCode "
                    + "AND SC.floorNum =:floorNum AND ((SC.toDate IS NULL AND SC.fromDate <= :fromDate) "
                    + "OR (SC.fromDate <= :fromDate AND SC.toDate >= :fromDate))");
    qry.setString("constrTypeCode", constrTypeCode);
    qry.setInteger("floorNum", floorNum);
    qry.setDate("fromDate", fromDate);
    return (StructureClassification) qry.uniqueResult();
}

From source file:org.egov.ptis.domain.dao.property.StructureClassificationHibernateDAO.java

License:Open Source License

/**
 * To get the construction cost by Construction Type
 * /*from w ww .  j  a v  a 2  s.  c o m*/
 * @param constrTypeCode
 * @return {@link StructureClassification}StructureClassification
 * */
@Override
public StructureClassification getStructureClassification(String constrTypeCode) {
    Query qry = getCurrentSession()
            .createQuery("FROM StructureClassification SC WHERE SC.constrTypeCode =:constrTypeCode "
                    + "AND ((SC.toDate IS NULL AND SC.fromDate <= :currDate) OR (SC.fromDate <= :currDate AND SC.toDate >= :currDate))");
    qry.setString("constrTypeCode", constrTypeCode);
    qry.setDate("currDate", new Date());
    return (StructureClassification) qry.uniqueResult();
}

From source file:org.egov.ptis.domain.dao.property.StructureClassificationHibernateDAO.java

License:Open Source License

/**
 * To get the construction cost by Construction Type Code and From Date
 * /*ww w  .j ava2  s  .  c  o m*/
 * @param constrTypeCode
 * @param fromDate
 * @return {@link StructureClassification} StructureClassification
 **/
@Override
public StructureClassification getStructureClassification(String constrTypeCode, Date fromDate) {
    Query qry = getCurrentSession()
            .createQuery("FROM StructureClassification SC WHERE SC.constrTypeCode =:constrTypeCode "
                    + "AND ((SC.toDate IS NULL AND SC.fromDate <= :fromDate) OR (SC.fromDate <= :fromDate AND SC.toDate >= :fromDate))");
    qry.setString("constrTypeCode", constrTypeCode);
    qry.setDate("fromDate", fromDate);
    return (StructureClassification) qry.uniqueResult();
}

From source file:org.egov.ptis.service.utils.PropertyTaxCommonUtils.java

License:Open Source License

/**
 * Gives the first half of the current financial year
 *
 * @return Installment - the first half of the current financial year for PT module
 *//*  w w  w  .  j av a 2s.  c o m*/
public Installment getCurrentInstallment() {
    final Query query = getSession().createQuery(
            "select installment from Installment installment,CFinancialYear finYear where installment.module.name =:moduleName  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.fromDate asc ");
    query.setString("moduleName", PropertyTaxConstants.PTMODULENAME);
    query.setDate("currDate", new Date());
    final List<Installment> installments = query.list();
    return installments.get(0);
}

From source file:org.egov.ptis.service.utils.PropertyTaxCommonUtils.java

License:Open Source License

@SuppressWarnings("unchecked")
public List<CFinancialYear> getAllFinancialYearsBetweenDates(final Date fromDate, final Date toDate) {
    final Query query = getSession().createQuery(
            " from CFinancialYear cfinancialyear where cfinancialyear.startingDate <:eDate and cfinancialyear.endingDate >=:sDate order by finYearRange asc ");
    query.setDate("sDate", fromDate);
    query.setDate("eDate", toDate);
    return query.list();
}

From source file:org.egov.services.instrument.InstrumentService.java

License:Open Source License

/**
 * returns list of InstrumentVouchers reconciled from reconcilationFromDate to reconcilationToDate to get list of
 * InstrumentVouchers reconciled on a perticular date pass both as same Date 'dd/MM/yyyy'),reconcilationToDate('dd/MM/yyyy')
 *
 * @return List of InstrumentVouchers/*from  w  w w.j  a  va  2 s  .c  om*/
 */
public List<InstrumentVoucher> getReconciledCheques(final Date reconcilationFromDate,
        final Date reconcilationToDate) throws ApplicationRuntimeException {
    if (reconcilationFromDate == null || reconcilationToDate == null)
        throw new ApplicationRuntimeException(
                "reconcilationFromDate and reconcilationToDate should not be null");
    final Query qry = persistenceService.getSession().createQuery(
            "select iv from InstrumentVoucher iv inner join iv.instrumentHeaderId as  ih   where ih.statusId.description=:status"
                    + " and ih in (select iih from InstrumentOtherDetails io inner join io.instrumentHeaderId as iih where io.instrumentStatusDate>=:startDate and io.instrumentStatusDate<=:endDate )");
    qry.setString("status", FinancialConstants.INSTRUMENT_RECONCILED_STATUS);
    qry.setDate("startDate", reconcilationFromDate);
    qry.setDate("endDate", reconcilationToDate);
    return qry.list();
}