List of usage examples for org.hibernate.criterion Projections sum
public static AggregateProjection sum(String propertyName)
From source file:org.openmrs.module.inventory.db.hibernate.HibernateInventoryDAO.java
License:Open Source License
@Override public List<InventoryStoreItemTransactionDetail> listStoreItemViewStockBalance(Integer storeId, Integer categoryId, String itemName, String fromDate, String toDate, int min, int max) throws DAOException { Criteria criteria = sessionFactory.getCurrentSession() .createCriteria(InventoryStoreItemTransactionDetail.class, "transactionDetail") .createAlias("transactionDetail.transaction", "transaction") .createAlias("transactionDetail.item", "itemAlias") .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); ProjectionList proList = Projections.projectionList(); proList.add(Projections.groupProperty("item")).add(Projections.groupProperty("specification")) .add(Projections.sum("currentQuantity")).add(Projections.sum("quantity")) .add(Projections.sum("issueQuantity")); criteria.add(Restrictions.eq("transaction.store.id", storeId)); if (categoryId != null) { criteria.add(Restrictions.eq("itemAlias.subCategory.id", categoryId)); }//w ww. ja va2 s.c om if (!StringUtils.isBlank(itemName)) { criteria.add(Restrictions.like("itemAlias.name", "%" + itemName + "%")); } if (!StringUtils.isBlank(fromDate) && StringUtils.isBlank(toDate)) { String startFromDate = fromDate + " 00:00:00"; String endFromDate = fromDate + " 23:59:59"; try { criteria.add(Restrictions.and( Restrictions.ge("transactionDetail.createdOn", formatter.parse(startFromDate)), Restrictions.le("transactionDetail.createdOn", formatter.parse(endFromDate)))); } catch (Exception e) { // TODO: handle exception System.out.println("listSubStoreIndent>>Error convert date: " + e.toString()); e.printStackTrace(); } } else if (StringUtils.isBlank(fromDate) && !StringUtils.isBlank(toDate)) { String startToDate = toDate + " 00:00:00"; String endToDate = toDate + " 23:59:59"; try { criteria.add(Restrictions.and( Restrictions.ge("transactionDetail.createdOn", formatter.parse(startToDate)), Restrictions.le("transactionDetail.createdOn", formatter.parse(endToDate)))); } catch (Exception e) { // TODO: handle exception System.out.println("listSubStoreIndent>>Error convert date: " + e.toString()); e.printStackTrace(); } } else if (!StringUtils.isBlank(fromDate) && !StringUtils.isBlank(toDate)) { String startToDate = fromDate + " 00:00:00"; String endToDate = toDate + " 23:59:59"; try { criteria.add(Restrictions.and( Restrictions.ge("transactionDetail.createdOn", formatter.parse(startToDate)), Restrictions.le("transactionDetail.createdOn", formatter.parse(endToDate)))); } catch (Exception e) { // TODO: handle exception System.out.println("listInventorySubStoreIndent>>Error convert date: " + e.toString()); e.printStackTrace(); } } criteria.setProjection(proList); if (max > 0) { criteria.setFirstResult(min).setMaxResults(max); } List<Object> lst = criteria.list(); if (lst == null || lst.size() == 0) { return null; } List<InventoryStoreItemTransactionDetail> list = new ArrayList<InventoryStoreItemTransactionDetail>(); for (int i = 0; i < lst.size(); i++) { Object[] row = (Object[]) lst.get(i); InventoryStoreItemTransactionDetail tDetail = new InventoryStoreItemTransactionDetail(); tDetail.setItem((InventoryItem) row[0]); tDetail.setSpecification((InventoryItemSpecification) row[1]); tDetail.setCurrentQuantity((Integer) row[2]); tDetail.setQuantity((Integer) row[3]); tDetail.setIssueQuantity((Integer) row[4]); list.add(tDetail); } return list; }
From source file:org.openmrs.module.inventory.db.hibernate.HibernateInventoryDAO.java
License:Open Source License
@Override public Integer countStoreItemViewStockBalance(Integer storeId, Integer categoryId, String itemName, String fromDate, String toDate) throws DAOException { Criteria criteria = sessionFactory.getCurrentSession() .createCriteria(InventoryStoreItemTransactionDetail.class, "transactionDetail") .createAlias("transactionDetail.transaction", "transaction") .createAlias("transactionDetail.item", "itemAlias"); ProjectionList proList = Projections.projectionList(); proList.add(Projections.groupProperty("item")).add(Projections.groupProperty("specification")) .add(Projections.sum("currentQuantity")).add(Projections.sum("quantity")) .add(Projections.sum("issueQuantity")); criteria.add(Restrictions.eq("transaction.store.id", storeId)); if (categoryId != null) { criteria.add(Restrictions.eq("itemAlias.subCategory.id", categoryId)); }/*from w w w . j a va 2 s . c o m*/ if (!StringUtils.isBlank(itemName)) { criteria.add(Restrictions.like("itemAlias.name", "%" + itemName + "%")); } if (!StringUtils.isBlank(fromDate) && StringUtils.isBlank(toDate)) { String startFromDate = fromDate + " 00:00:00"; String endFromDate = fromDate + " 23:59:59"; try { criteria.add(Restrictions.and( Restrictions.ge("transactionDetail.createdOn", formatter.parse(startFromDate)), Restrictions.le("transactionDetail.createdOn", formatter.parse(endFromDate)))); } catch (Exception e) { // TODO: handle exception System.out.println("listSubStoreIndent>>Error convert date: " + e.toString()); e.printStackTrace(); } } else if (StringUtils.isBlank(fromDate) && !StringUtils.isBlank(toDate)) { String startToDate = toDate + " 00:00:00"; String endToDate = toDate + " 23:59:59"; try { criteria.add(Restrictions.and( Restrictions.ge("transactionDetail.createdOn", formatter.parse(startToDate)), Restrictions.le("transactionDetail.createdOn", formatter.parse(endToDate)))); } catch (Exception e) { // TODO: handle exception System.out.println("listSubStoreIndent>>Error convert date: " + e.toString()); e.printStackTrace(); } } else if (!StringUtils.isBlank(fromDate) && !StringUtils.isBlank(toDate)) { String startToDate = fromDate + " 00:00:00"; String endToDate = toDate + " 23:59:59"; try { criteria.add(Restrictions.and( Restrictions.ge("transactionDetail.createdOn", formatter.parse(startToDate)), Restrictions.le("transactionDetail.createdOn", formatter.parse(endToDate)))); } catch (Exception e) { // TODO: handle exception System.out.println("listInventorySubStoreIndent>>Error convert date: " + e.toString()); e.printStackTrace(); } } criteria.setProjection(proList); List<Object> list = criteria.list(); Number total = 0; if (!CollectionUtils.isEmpty(list)) { total = (Number) list.size(); } return total.intValue(); }
From source file:org.opentaps.financials.domain.ledger.EncumbranceRepository.java
License:Open Source License
/** {@inheritDoc} */ @SuppressWarnings("unchecked") public BigDecimal getTotalEncumberedValue(String organizationPartyId, Map<String, String> accountingTags, Timestamp asOfDate) throws RepositoryException { Session session = null;// w ww . ja v a 2 s.com BigDecimal encumberedValueTotal = null; try { session = getInfrastructure().getSession(); // retrieve max snapshot time under asOfDate Criteria lastSnapshotDate = session.createCriteria(EncumbranceSnapshot.class); lastSnapshotDate.add(Restrictions.le(EncumbranceSnapshot.Fields.snapshotDatetime.getName(), asOfDate)); lastSnapshotDate.setProjection(Projections.max(EncumbranceSnapshot.Fields.snapshotDatetime.getName())); List<Timestamp> snapshotMaxDate = lastSnapshotDate.list(); Timestamp ts = snapshotMaxDate.get(0); if (ts == null) { Debug.logWarning("There is no encumbrance snapshot created before " + asOfDate.toString(), MODULE); return null; } Debug.logInfo("Using encumbrance snapshot from " + ts.toString(), MODULE); Criteria snapshot = session.createCriteria(EncumbranceSnapshot.class); snapshot.add(Restrictions.eq(EncumbranceSnapshot.Fields.snapshotDatetime.getName(), ts)); List<EncumbranceSnapshot> snapshots = snapshot.list(); String snapshotId = snapshots.get(0).getEncumbranceSnapshotId(); Criteria encumberedValueCriteria = session.createCriteria(EncumbranceDetail.class); encumberedValueCriteria.add(Restrictions.eq( String.format("id.%1$s", EncumbranceDetail.Fields.encumbranceSnapshotId.getName()), snapshotId)); encumberedValueCriteria.add( Restrictions.eq(EncumbranceDetail.Fields.organizationPartyId.getName(), organizationPartyId)); buildAccountingTagConditions(encumberedValueCriteria, accountingTags); encumberedValueCriteria .setProjection(Projections.sum(EncumbranceDetail.Fields.encumberedAmount.getName())); List<BigDecimal> totals = encumberedValueCriteria.list(); encumberedValueTotal = totals.get(0); } catch (InfrastructureException e) { throw new RepositoryException(e.getMessage()); } catch (HibernateException e) { // return the RepositoryException with the message of exception throw new RepositoryException(e.getMessage()); } finally { if (session != null) { session.close(); } } return encumberedValueTotal; }
From source file:org.sculptor.framework.accessimpl.jpahibernate.JpaHibFindByConditionStatAccessImpl.java
License:Apache License
private void addStatProjection(Criteria criteria) throws PersistenceException { ProjectionList projList = Projections.projectionList(); projList.add(Projections.rowCount()); for (ColumnStatRequest<T> column : statRequest) { if (column.isFlag(COUNT)) { projList.add(Projections.count(column.getColumn().getName())); }/*w ww. j a v a 2 s. co m*/ if (column.isFlag(MIN)) { projList.add(Projections.min(column.getColumn().getName())); } if (column.isFlag(MAX)) { projList.add(Projections.max(column.getColumn().getName())); } if (column.isFlag(AVERAGE)) { projList.add(Projections.avg(column.getColumn().getName())); } if (column.isFlag(SUM)) { projList.add(Projections.sum(column.getColumn().getName())); } if (column.isFlag(GROUP_BY_VAL)) { projList.add(Projections.groupProperty(column.getColumn().getName())); } // Time groups for (ColumnStatType flag : TIME_GROUPS) { if (column.isFlag(flag)) { projList.add(makeTimeGroupBy(column, flag, criteria)); } } } criteria.setProjection(projList); }
From source file:pkg.CriteriaProductCode.java
public void totalSalary() { Session session = sessionFactory.openSession(); Transaction tx = null;//from w w w .ja v a 2 s.c om try { tx = session.beginTransaction(); Criteria cr = session.createCriteria(ProductCode.class); // To get total salary. cr.setProjection(Projections.sum("salary")); List totalSalary = cr.list(); System.out.println("Total Salary: " + totalSalary.get(0)); tx.commit(); } catch (HibernateException e) { if (tx != null) { tx.rollback(); } e.printStackTrace(); } finally { session.close(); } }
From source file:pl.umk.mat.zawodyweb.www.ranking.RankingACM.java
License:Open Source License
private RankingTable getRankingACM(int contest_id, Timestamp checkDate, boolean admin, Integer series_id) { Session hibernateSession = HibernateUtil.getSessionFactory().getCurrentSession(); Timestamp checkTimestamp;/*from www .j a v a2 s .c o m*/ Timestamp visibleTimestamp; UsersDAO usersDAO = DAOFactory.DEFAULT.buildUsersDAO(); SeriesDAO seriesDAO = DAOFactory.DEFAULT.buildSeriesDAO(); ProblemsDAO problemsDAO = DAOFactory.DEFAULT.buildProblemsDAO(); Map<Integer, UserACM> mapUserACM = new HashMap<>(); boolean allTests; boolean frozenRanking = false; boolean frozenSeria; long lCheckDate = checkDate.getTime(); for (Series series : seriesDAO.findByContestsid(contest_id)) { if ((series_id == null && series.getVisibleinranking() == false) || (series_id != null && series_id.equals(series.getId()) == false)) { continue; } if (series.getStartdate().getTime() > lCheckDate) { continue; } frozenSeria = false; checkTimestamp = checkDate; allTests = admin; if (!admin && series.getFreezedate() != null) { if (lCheckDate > series.getFreezedate().getTime() && (series.getUnfreezedate() == null || lCheckDate < series.getUnfreezedate().getTime())) { checkTimestamp = new Timestamp(series.getFreezedate().getTime()); if (series.getUnfreezedate() != null) { frozenRanking = true; } frozenSeria = true; } } if (checkTimestamp.before(series.getStartdate())) { visibleTimestamp = new Timestamp(0); } else { visibleTimestamp = new Timestamp(series.getStartdate().getTime()); } if (series.getUnfreezedate() != null) { if (checkDate.after(series.getUnfreezedate())) { allTests = true; } } for (Problems problems : problemsDAO.findBySeriesid(series.getId())) { if (problems.getVisibleinranking() == false) { continue; } // select sum(maxpoints) from tests where problemsid='7' and visibility=1 Number maxPoints; Number testCount; if (allTests) { Object[] o = (Object[]) hibernateSession.createCriteria(Tests.class) .setProjection(Projections.projectionList().add(Projections.sum("maxpoints")) .add(Projections.rowCount())) .add(Restrictions.eq("problems.id", problems.getId())).uniqueResult(); maxPoints = (Number) o[0]; testCount = (Number) o[1]; } else { Object[] o = (Object[]) hibernateSession.createCriteria(Tests.class) .setProjection(Projections.projectionList().add(Projections.sum("maxpoints")) .add(Projections.rowCount())) .add(Restrictions.and(Restrictions.eq("problems.id", problems.getId()), Restrictions.eq("visibility", 1))) .uniqueResult(); maxPoints = (Number) o[0]; testCount = (Number) o[1]; } if (maxPoints == null) { maxPoints = 0; // To nie powinno si nigdy zdarzy ;).. chyba, e nie ma testu przy zadaniu? } if (testCount == null) { testCount = 0; // To nie powinno si zdarzy nigdy. } Query query; if (allTests == true) { query = hibernateSession.createSQLQuery("" + "select usersid, min(sdate) sdate " // zapytanie zewntrzne znajduj minimaln dat wysania poprawnego rozwizania dla kadego usera + "from submits " + "where id in (" + " select submits.id " // zapytanie wewntrzne znajduje wszystkie id, ktre zdobyy maksa punktw + " from submits,results,tests " + " where submits.problemsid = :problemsId " + " and submits.id=results.submitsid " + " and tests.id = results.testsid " + " and results.status = :statusAcc " + " and submits.state = :stateDone " + " and sdate <= :currentTimestamp " + " and sdate >= :visibleTimestamp " + " and visibleInRanking=true" //+ " and tests.visibility=1 " + " group by submits.id,usersid,sdate " + " having sum(points) = :maxPoints " + " and count(points) = :testCount " + " ) " + "group by usersid") .setInteger("problemsId", problems.getId()) .setInteger("statusAcc", ResultsStatusEnum.ACC.getCode()) .setInteger("stateDone", SubmitsStateEnum.DONE.getCode()) .setInteger("maxPoints", maxPoints.intValue()) .setInteger("testCount", testCount.intValue()) .setTimestamp("currentTimestamp", checkTimestamp) .setTimestamp("visibleTimestamp", visibleTimestamp); } else { query = hibernateSession.createSQLQuery("" + "select usersid, min(sdate) sdate " + "from submits " + "where id in (" + " select submits.id " + " from submits,results,tests " + " where submits.problemsid = :problemsId " + " and submits.id=results.submitsid " + " and tests.id = results.testsid " + " and results.status = :statusAcc " + " and submits.state = :stateDone " + " and sdate <= :currentTimestamp " + " and sdate >= :visibleTimestamp " + " and visibleInRanking=true" + " and tests.visibility=1 " // FIXME: should be ok + " group by submits.id,usersid,sdate " + " having sum(points) = :maxPoints " + " and count(points) = :testCount " + " ) " + "group by usersid") .setInteger("problemsId", problems.getId()) .setInteger("statusAcc", ResultsStatusEnum.ACC.getCode()) .setInteger("stateDone", SubmitsStateEnum.DONE.getCode()) .setInteger("maxPoints", maxPoints.intValue()) .setInteger("testCount", testCount.intValue()) .setTimestamp("currentTimestamp", checkTimestamp) .setTimestamp("visibleTimestamp", visibleTimestamp); } for (Object list : query.list()) { // tu jest zwrcona lista "zaakceptowanych" w danym momencie rozwiza zadania Object[] o = (Object[]) list; Number bombs = (Number) hibernateSession.createCriteria(Submits.class) .setProjection(Projections.rowCount()) .add(Restrictions.eq("problems.id", (Number) problems.getId())) .add(Restrictions.eq("users.id", (Number) o[0])) .add(Restrictions.lt("sdate", (Timestamp) o[1])).uniqueResult(); if (bombs == null) { bombs = 0; } UserACM user = mapUserACM.get((Integer) o[0]); if (user == null) { Integer user_id = (Integer) o[0]; Users users = usersDAO.getById(user_id); user = new UserACM(user_id, users); mapUserACM.put((Integer) o[0], user); } user.add(maxPoints.intValue(), new SolutionACM(problems.getAbbrev(), ((Timestamp) o[1]).getTime(), (maxPoints.equals(0) ? 0 : ((Timestamp) o[1]).getTime() - series.getStartdate().getTime()) / 1000, series.getPenaltytime() * bombs.intValue(), bombs.intValue(), problems.getName(), frozenSeria)); } } } /* * Tworzenie rankingu z danych */ List<UserACM> cre = new ArrayList<>(); cre.addAll(mapUserACM.values()); Collections.sort(cre); /* * nazwy kolumn */ List<String> columnsCaptions = new ArrayList<>(); columnsCaptions.add(messages.getString("points")); columnsCaptions.add(messages.getString("time")); columnsCaptions.add(messages.getString("solutions")); /* * nazwy klas css-owych dla kolumn */ List<String> columnsCSS = new ArrayList<>(); columnsCSS.add("small"); // points columnsCSS.add("nowrap small"); // time columnsCSS.add("big left"); // solutions /* * tabelka z rankingiem */ List<RankingEntry> vectorRankingEntry = new ArrayList<>(); int place = 0; long totalTime = -1; int points = Integer.MAX_VALUE; for (UserACM user : cre) { if (points > user.points || (points == user.points && totalTime < user.totalTime)) { ++place; points = user.points; totalTime = user.totalTime; } List<String> v = new ArrayList<>(); v.add(Integer.toString(user.points)); v.add(parseTime(user.totalTime)); v.add(user.getSolutionsForRanking()); vectorRankingEntry .add(new RankingEntry(place, user.firstname, user.lastname, user.login, user.loginOnly, v)); } return new RankingTable(columnsCaptions, columnsCSS, vectorRankingEntry, frozenRanking); }
From source file:pl.umk.mat.zawodyweb.www.ranking.RankingACM.java
License:Open Source License
@Override public List<Integer> getRankingSolutions(int contest_id, Integer series_id, Timestamp checkDate, boolean admin) { Session hibernateSession = HibernateUtil.getSessionFactory().getCurrentSession(); Timestamp checkTimestamp;/* www .j a v a2 s .co m*/ Timestamp visibleTimestamp; SeriesDAO seriesDAO = DAOFactory.DEFAULT.buildSeriesDAO(); ProblemsDAO problemsDAO = DAOFactory.DEFAULT.buildProblemsDAO(); List<Integer> submits = new ArrayList<>(); boolean allTests; long lCheckDate = checkDate.getTime(); for (Series series : seriesDAO.findByContestsid(contest_id)) { if ((series_id == null && series.getVisibleinranking() == false) || (series_id != null && series_id.equals(series.getId()) == false)) { continue; } if (series.getStartdate().getTime() > lCheckDate) { continue; } checkTimestamp = checkDate; allTests = admin; if (!admin && series.getFreezedate() != null) { if (lCheckDate > series.getFreezedate().getTime() && (series.getUnfreezedate() == null || lCheckDate < series.getUnfreezedate().getTime())) { checkTimestamp = new Timestamp(series.getFreezedate().getTime()); } } if (checkTimestamp.before(series.getStartdate())) { visibleTimestamp = new Timestamp(0); } else { visibleTimestamp = new Timestamp(series.getStartdate().getTime()); } if (series.getUnfreezedate() != null) { if (checkDate.after(series.getUnfreezedate())) { allTests = true; } } for (Problems problems : problemsDAO.findBySeriesid(series.getId())) { if (problems.getVisibleinranking() == false) { continue; } // select sum(maxpoints) from tests where problemsid='7' and visibility=1 Number maxPoints; Number testCount; if (allTests) { Object[] o = (Object[]) hibernateSession.createCriteria(Tests.class) .setProjection(Projections.projectionList().add(Projections.sum("maxpoints")) .add(Projections.rowCount())) .add(Restrictions.eq("problems.id", problems.getId())).uniqueResult(); maxPoints = (Number) o[0]; testCount = (Number) o[1]; } else { Object[] o = (Object[]) hibernateSession.createCriteria(Tests.class) .setProjection(Projections.projectionList().add(Projections.sum("maxpoints")) .add(Projections.rowCount())) .add(Restrictions.and(Restrictions.eq("problems.id", problems.getId()), Restrictions.eq("visibility", 1))) .uniqueResult(); maxPoints = (Number) o[0]; testCount = (Number) o[1]; } if (maxPoints == null) { maxPoints = 0; // To nie powinno si nigdy zdarzy ;).. chyba, e nie ma testu przy zadaniu? } if (testCount == null) { testCount = 0; // To nie powinno si zdarzy nigdy. } Query query; if (allTests == true) { query = hibernateSession.createSQLQuery("" + "select min(id) sid " // zapytanie zewntrzne znajduj minimaln dat wysania poprawnego rozwizania dla kadego usera + "from submits " + "where id in (" + " select submits.id " // zapytanie wewntrzne znajduje wszystkie id, ktre zdobyy maksa punktw + " from submits,results,tests " + " where submits.problemsid = :problemsId " + " and submits.id = results.submitsid " + " and tests.id = results.testsid " + " and results.status = :statusAcc " + " and submits.state = :stateDone " + " and sdate <= :currentTimestamp " + " and sdate >= :visibleTimestamp " + " and visibleInRanking=true" //+ " and tests.visibility=1 " + " group by submits.id,usersid,sdate " + " having sum(points) = :maxPoints " + " and count(points) = :testsCount " + " ) " + "group by usersid") .setInteger("problemsId", problems.getId()) .setInteger("statusAcc", ResultsStatusEnum.ACC.getCode()) .setInteger("stateDone", SubmitsStateEnum.DONE.getCode()) .setInteger("maxPoints", maxPoints.intValue()) .setInteger("testCount", testCount.intValue()) .setTimestamp("currentTimestamp", checkTimestamp) .setTimestamp("visibleTimestamp", visibleTimestamp); } else { query = hibernateSession.createSQLQuery("" + "select min(id) sid " + "from submits " + "where id in (" + " select submits.id " + " from submits,results,tests " + " where submits.problemsid = :problemsId " + " and submits.id = results.submitsid " + " and tests.id = results.testsid " + " and results.status = :statusAcc " + " and submits.state = :stateDone " + " and sdate <= :currentTimestamp " + " and sdate >= :visibleTimestamp " + " and visibleInRanking=true" + " and tests.visibility=1 " // FIXME: should be ok + " group by submits.id,usersid,sdate " + " having sum(points) = :maxPoints " + " and count(points) = :testCount " + " ) " + "group by usersid") .setInteger("problemsId", problems.getId()) .setInteger("statusAcc", ResultsStatusEnum.ACC.getCode()) .setInteger("stateDone", SubmitsStateEnum.DONE.getCode()) .setInteger("maxPoints", maxPoints.intValue()) .setInteger("testCount", testCount.intValue()) .setTimestamp("currentTimestamp", checkTimestamp) .setTimestamp("visibleTimestamp", visibleTimestamp); } for (Object id : query.list()) { // tu jest zwrcona lista "zaakceptowanych" w danym momencie rozwiza zadania submits.add((Integer) id); } } } return submits; }
From source file:to.etc.domui.hibernate.model.CriteriaCreatingVisitor.java
License:Open Source License
@Override public void visitPropertySelection(QPropertySelection n) throws Exception { String name = parseSubcriteria(n.getProperty()); switch (n.getFunction()) { default:/*w w w. j a va 2 s. c om*/ throw new IllegalStateException("Unexpected selection item function: " + n.getFunction()); case AVG: m_lastProj = Projections.avg(name); break; case MAX: m_lastProj = Projections.max(name); break; case MIN: m_lastProj = Projections.min(name); break; case SUM: m_lastProj = Projections.sum(name); break; case COUNT: m_lastProj = Projections.count(name); break; case COUNT_DISTINCT: m_lastProj = Projections.countDistinct(name); break; case ID: m_lastProj = Projections.id(); break; case PROPERTY: m_lastProj = Projections.groupProperty(name); break; case ROWCOUNT: m_lastProj = Projections.rowCount(); break; case DISTINCT: m_lastProj = Projections.distinct(Projections.property(name)); break; } }