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.ptis.domain.dao.property.BoundaryCategoryHibDao.java
License:Open Source License
@Override public BoundaryCategory getBoundaryCategoryByBoundry(Boundary bndry) { BoundaryCategory bndryCategory = null; Query qry = null; if (bndry != null) { qry = getCurrentSession().createQuery("from BoundaryCategory 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);/*from www. j a v a 2 s. c o m*/ qry.setDate("currDate", new Date()); if (qry.list().size() == 1) bndryCategory = (BoundaryCategory) qry.uniqueResult(); } return bndryCategory; }
From source file:org.egov.ptis.domain.dao.property.BoundaryCategoryHibDao.java
License:Open Source License
@Override public BoundaryCategory getBoundaryCategoryByBoundryAndDate(Boundary bndry, Date date) { BoundaryCategory bndryCategory = null; Query qry = null; if (bndry != null && date != null) { qry = getCurrentSession().createQuery("from BoundaryCategory 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);// w ww. j ava 2 s . c o m qry.setDate("date", date); if (qry.list().size() == 1) bndryCategory = (BoundaryCategory) qry.uniqueResult(); } return bndryCategory; }
From source file:org.egov.ptis.domain.dao.property.BoundaryCategoryHibDao.java
License:Open Source License
@Override public Category getCategoryByBoundryAndUsage(Boundary bndry, PropertyUsage propertyUsage) { Category category = null;//from ww w .j av a2 s. c om Query qry = null; if (bndry != null && propertyUsage != null) { qry = getCurrentSession().createQuery( "select C from Category C inner join C.catBoundaries BC where BC.bndry = :bndry and C.propUsage = :propertyUsage AND (" + "(BC.toDate IS NULL AND BC.fromDate <= :currDate) " + "OR " + "(BC.fromDate <= :currDate AND BC.toDate >= :currDate)) "); qry.setEntity(BOUNDARY, bndry); qry.setEntity("propertyUsage", propertyUsage); 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 getCategoryByBoundryAndUsageAndDate(Boundary bndry, PropertyUsage propertyUsage, Date date) { Category category = null;// www . j av a2s .co m Query qry = null; if (bndry != null && propertyUsage != null && date != null) { qry = getCurrentSession().createQuery( "select C from Category C inner join C.catBoundaries BC where BC.bndry = :bndry and C.propUsage = :propertyUsage AND (" + "(BC.toDate IS NULL AND BC.fromDate <= :date) " + "OR " + "(BC.fromDate <= :date AND BC.toDate >= :date)) "); qry.setEntity(BOUNDARY, bndry); qry.setEntity("propertyUsage", propertyUsage); qry.setDate("date", date); if (qry.list().size() == 1) category = (Category) qry.uniqueResult(); } return category; }
From source file:org.egov.ptis.domain.dao.property.CategoryHibDao.java
License:Open Source License
@Override public List getAllCategoriesbyHistory() { Query qry = getCurrentSession() .createQuery("from Category C where " + "(C.toDate IS NULL AND C.fromDate <= :currDate) " + "OR " + "(C.fromDate <= :currDate AND C.toDate >= :currDate)) "); qry.setDate("currDate", new Date()); return qry.list(); }
From source file:org.egov.ptis.domain.dao.property.CategoryHibDao.java
License:Open Source License
@Override public Float getCategoryAmount(Integer usageId, Integer bndryId) { Query qry = null; Float catAmt = null;/*from ww w . j a v a 2s . c o m*/ if (usageId != null && bndryId != null) { qry = getCurrentSession().createQuery( "select C.categoryAmount from Category C left join C.catBoundaries cb left join cb.bndry cbndry where cbndry.id =:bndryId and C.propUsage =:usageId AND (" + "(C.toDate IS NULL AND C.fromDate <= :currDate) " + "OR " + "(C.fromDate <= :currDate AND C.toDate >= :currDate)) "); qry.setInteger("bndryId", bndryId); qry.setInteger("usageId", usageId); qry.setDate("currDate", new Date()); // qry.setInteger("instId",instId); catAmt = (Float) qry.uniqueResult(); } return catAmt; }
From source file:org.egov.ptis.domain.dao.property.CategoryHibDao.java
License:Open Source License
@Override public Float getCategoryAmountByUsageAndBndryAndDate(Integer usageId, Integer bndryId, Date fromDate) { Query qry = null; Float catAmt = null;// www. j a va2s .c o m if (usageId != null && bndryId != null && fromDate != null) { qry = getCurrentSession().createQuery( "select C.categoryAmount from Category C left join C.catBoundaries cb left join cb.bndry cbndry where cbndry.id =:bndryId and C.propUsage =:usageId AND (" + "(C.toDate IS NULL AND C.fromDate <= :fromDate) " + "OR " + "(C.fromDate <= :fromDate AND C.toDate >= :fromDate)) "); qry.setInteger("bndryId", bndryId); qry.setInteger("usageId", usageId); qry.setDate(FROM_DATE, fromDate); // qry.setInteger("instId",instId); catAmt = (Float) qry.uniqueResult(); } return catAmt; }
From source file:org.egov.ptis.domain.dao.property.PropertyOccupationHibernateDAO.java
License:Open Source License
@Override public PropertyOccupation getPropertyOccupationByOccCodeAndUsage(String occCode, Long propertyUsage) { Query qry = null; PropertyOccupation propOcc = null;//from w w w. ja va 2s. co m if (occCode != null && propertyUsage != null) { qry = getCurrentSession().createQuery( "from PropertyOccupation PO where PO.occupancyCode = :occCode and PO.propertyUsage.id = :propertyUsage and :date between PO.fromDate and PO.toDate "); qry.setString("occCode", occCode); qry.setLong("propertyUsage", propertyUsage); qry.setDate("date", new Date()); if (qry.list().size() == 1) propOcc = (PropertyOccupation) qry.uniqueResult(); } return propOcc; }
From source file:org.egov.ptis.domain.dao.property.PropertyOccupationHibernateDAO.java
License:Open Source License
@Override public PropertyOccupation getPropertyOccupationByOccCode(String occCode) { PropertyOccupation propOcc = null;/* www.ja va 2 s . co m*/ Query qry = null; if (occCode != null) { qry = getCurrentSession() .createQuery("from PropertyOccupation PO where PO.occupancyCode = :occCode AND (" + "(PO.toDate IS NULL AND PO.fromDate <= :currDate) " + "OR " + "(PO.fromDate <= :currDate AND PO.toDate >= :currDate)) "); qry.setString("occCode", occCode); qry.setDate("currDate", new Date()); if (qry.list().size() == 1) propOcc = (PropertyOccupation) qry.uniqueResult(); } return propOcc; }
From source file:org.egov.ptis.domain.dao.property.PropertyOccupationHibernateDAO.java
License:Open Source License
@Override public PropertyOccupation getPropertyOccupationByOccCodeAndDate(String occCode, Date fromDate) { PropertyOccupation propOcc = null;/*from ww w . ja va 2 s.com*/ Query qry = null; if (occCode != null) { qry = getCurrentSession() .createQuery("from PropertyOccupation PO where PO.occupancyCode = :occCode AND (" + "(PO.toDate IS NULL AND PO.fromDate <= :fromDate) " + "OR " + "(PO.fromDate <= :fromDate AND PO.toDate >= :fromDate)) "); qry.setString("occCode", occCode); qry.setDate("fromDate", fromDate); if (qry.list().size() == 1) propOcc = (PropertyOccupation) qry.uniqueResult(); } return propOcc; }