List of usage examples for org.hibernate.criterion DetachedCriteria setProjection
public DetachedCriteria setProjection(Projection projection)
From source file:org.gaixie.micrite.car.dao.hibernate.CarfileDAOImpl.java
License:Open Source License
public int advancedFindCount(SearchBean[] queryBean) { DetachedCriteria criteria = SearchFactory.generateCriteria(Carfile.class, queryBean); criteria.add(Expression.eq("status", ICarfileService.STATUS_NORMAL)); criteria.setProjection(Projections.rowCount()); return (Integer) getHibernateTemplate().findByCriteria(criteria).get(0); }
From source file:org.gaixie.micrite.car.dao.hibernate.CarfileDAOImpl.java
License:Open Source License
public int findByCreateDateSpacingCount(int carType) { DetachedCriteria criteria = DetachedCriteria.forClass(Carfile.class); criteria.add(Expression.eq("status", ICarfileService.STATUS_NORMAL)); criteria.createAlias("skillRank", "cs"); if (0 != carType) { criteria.add(Expression.eq("cs.id", carType)); }/* w ww . j a v a2s . c o m*/ criteria.setProjection(Projections.rowCount()); return (Integer) getHibernateTemplate().findByCriteria(criteria).get(0); }
From source file:org.gaixie.micrite.car.dao.hibernate.CarfileDAOImpl.java
License:Open Source License
/**? //from w w w. j a v a 2s . co m */ public int findCarfileBySkill(int carType, int skill) { DetachedCriteria criteria = DetachedCriteria.forClass(Carfile.class); criteria.add(Expression.eq("status", ICarfileService.STATUS_NORMAL)); // criteria.add(Expression.like("licenseNumber","%"+licenseNumber+"%")); if (0 != carType) criteria.add(Restrictions.eq("carType.id", carType)); if (0 != skill) criteria.add(Restrictions.eq("skillRank.id", skill)); criteria.setProjection(Projections.rowCount()); return (Integer) getHibernateTemplate().findByCriteria(criteria).get(0); // List<Carfile> list= getHibernateTemplate().find("from Carfile c where c.carType.id like ? and c.skillRank.id=? ",new Object[]{carType,skill}); // if(list.size()!=1)return 0; // return list.get(0).getId(); }
From source file:org.gaixie.micrite.car.dao.hibernate.CarfileDAOImpl.java
License:Open Source License
@SuppressWarnings("unchecked") public List findCSGroupByTelVague(SearchBean[] queryBean) { DetachedCriteria criteria = SearchFactory.generateCriteria(Carfile.class, queryBean); criteria.add(Expression.eq("status", ICarfileService.STATUS_NORMAL)); criteria.addOrder(Order.desc("editDate")); criteria.createAlias("carType", "cs"); criteria.setProjection(Projections.projectionList().add(Projections.count("cs.name")) .add(Projections.groupProperty("cs.name"))); List<Carfile> list = getHibernateTemplate().findByCriteria(criteria); // desidedExpiredFlag(list); return list;// w w w.ja v a 2s. com }
From source file:org.gaixie.micrite.car.dao.hibernate.CarfileDAOImpl.java
License:Open Source License
@Override public boolean existCar(Integer id, String license, Dictionary paiSe) { DetachedCriteria criteria = DetachedCriteria.forClass(Carfile.class); criteria.add(Expression.eq("status", ICarfileService.STATUS_NORMAL)); criteria.setProjection(Projections.rowCount()); criteria.add(Expression.eq("paiSe", paiSe)); criteria.add(Expression.eq("licenseNumber", license)); if (id != null) { criteria.add(Expression.ne("id", id)); }/* ww w. j a v a2 s. c om*/ return ((Integer) getHibernateTemplate().findByCriteria(criteria).get(0)) > 0; }
From source file:org.gaixie.micrite.crm.dao.hibernate.CarownerDAOImpl.java
License:Open Source License
public int advancedFindCount(SearchBean[] queryBean) { DetachedCriteria criteria = SearchFactory.generateCriteria(Carowner.class, queryBean); criteria.add(Restrictions.gt("id", 0)); criteria.setProjection(Projections.rowCount()); return (Integer) getHibernateTemplate().findByCriteria(criteria).get(0); }
From source file:org.gaixie.micrite.crm.dao.hibernate.CarownerDAOImpl.java
License:Open Source License
public int findByCreateDateSpacingCount(Date startDate, Date endDate, int customerSourceType) { DetachedCriteria criteria = DetachedCriteria.forClass(Carowner.class); criteria.add(Restrictions.gt("id", 0)); // criteria.createAlias("customerSource", "cs"); // if(0!=customerSourceType){ // criteria.add(Expression.eq("cs.id", customerSourceType)); // }// w ww . j a v a 2s . c o m criteria.add(Expression.between("createDate", startDate, endDate)); criteria.setProjection(Projections.rowCount()); return (Integer) getHibernateTemplate().findByCriteria(criteria).get(0); }
From source file:org.gaixie.micrite.crm.dao.hibernate.CarownerDAOImpl.java
License:Open Source License
@Override public boolean existCarowner(Integer id, String license, String name) { DetachedCriteria criteria = DetachedCriteria.forClass(Carowner.class); // criteria.add(Expression.eq("status", ICarfileService.STATUS_NORMAL)); criteria.setProjection(Projections.rowCount()); criteria.add(Expression.eq("name", name)); criteria.add(Expression.eq("license", license)); if (id != null) { criteria.add(Expression.ne("id", id)); }/*from www .j av a2s.c o m*/ return ((Integer) getHibernateTemplate().findByCriteria(criteria).get(0)) > 0; }
From source file:org.gaixie.micrite.crm.dao.hibernate.CustomerDAOImpl.java
License:Open Source License
public int advancedFindCount(SearchBean[] queryBean) { DetachedCriteria criteria = SearchFactory.generateCriteria(Carowner.class, queryBean); criteria.setProjection(Projections.rowCount()); return (Integer) getHibernateTemplate().findByCriteria(criteria).get(0); }
From source file:org.gaixie.micrite.crm.dao.hibernate.CustomerDAOImpl.java
License:Open Source License
public int findByCreateDateSpacingCount(Date startDate, Date endDate, int customerSourceType) { DetachedCriteria criteria = DetachedCriteria.forClass(Carowner.class); criteria.createAlias("customerSource", "cs"); if (0 != customerSourceType) { criteria.add(Expression.eq("cs.id", customerSourceType)); }//www.java2 s .c o m criteria.add(Expression.between("creation_ts", startDate, endDate)); criteria.setProjection(Projections.rowCount()); return (Integer) getHibernateTemplate().findByCriteria(criteria).get(0); }