Package org.hibernate.criterion

Examples of org.hibernate.criterion.ProjectionList


    criteria.add(Restrictions.eq("pianoDeiConti.codiceConto", nrMutuo));
    criteria.add(Restrictions.eq("legalEntity", legalEntity));
    criteria.add(Restrictions.eq("organizationUnit", organizationUnit));

    ProjectionList proList = Projections.projectionList();
    proList.add(Projections.groupProperty("pianoDeiConti.codiceGruppo"));
    proList.add(Projections.groupProperty("pianoDeiConti.codiceMastro"));
    proList.add(Projections.groupProperty("pianoDeiConti.codiceConto"));
    proList.add(Projections.sum("importoDare"));
    proList.add(Projections.sum("importoAvere"));
    proList.add(Projections.max("dataRegistrazione"));

    criteria.setProjection(proList);

    List<?> righe = getHibernateTemplate().findByCriteria(criteria);
View Full Code Here


    {
        // TODO: Include aggregators functionality in bzengine?
        Session ses = HibernateEntityManagerHelper.getSession(getEntityManager());

        Criteria crit = ses.createCriteria(CloudUsage.class);
        ProjectionList proList = Projections.projectionList();
        proList.add(Projections.sum(CloudUsage.SERVERS_TOTAL_PROPERTY));
        proList.add(Projections.sum(CloudUsage.SERVERS_RUNNING_PROPERTY));
        proList.add(Projections.sum(CloudUsage.STORAGE_TOTAL_PROPERTY));
        // proList.add(Projections.sum(CloudUsage.STORAGE_RESERVED_PROPERTY));
        proList.add(Projections.sum(CloudUsage.STORAGE_USED_PROPERTY));
        proList.add(Projections.sum(CloudUsage.PUBLIC_I_PS_TOTAL_PROPERTY));
        // proList.add(Projections.sum(CloudUsage.PUBLIC_I_PS_RESERVED_PROPERTY));
        proList.add(Projections.sum(CloudUsage.PUBLIC_I_PS_USED_PROPERTY));
        proList.add(Projections.sum(CloudUsage.V_MACHINES_TOTAL_PROPERTY));
        proList.add(Projections.sum(CloudUsage.V_MACHINES_RUNNING_PROPERTY));
        // proList.add(Projections.sum(CloudUsage.V_CPU_TOTAL_PROPERTY));
        // proList.add(Projections.sum(CloudUsage.V_CPU_RESERVED_PROPERTY));
        proList.add(Projections.sum(CloudUsage.V_CPU_USED_PROPERTY));
        // proList.add(Projections.sum(CloudUsage.V_MEMORY_TOTAL_PROPERTY));
        // proList.add(Projections.sum(CloudUsage.V_MEMORY_RESERVED_PROPERTY));
        proList.add(Projections.sum(CloudUsage.V_MEMORY_USED_PROPERTY));
        proList.add(Projections.sum(CloudUsage.V_STORAGE_TOTAL_PROPERTY));
        // proList.add(Projections.sum(CloudUsage.V_STORAGE_RESERVED_PROPERTY));
        proList.add(Projections.sum(CloudUsage.V_STORAGE_USED_PROPERTY));
        proList.add(Projections.sum(CloudUsage.NUM_USERS_CREATED_PROPERTY));
        proList.add(Projections.sum(CloudUsage.NUM_VDC_CREATED_PROPERTY));
        proList.add(Projections.sum(CloudUsage.NUM_ENTERPRISES_CREATED_PROPERTY));

        crit.setProjection(proList);
        Object[] obj = (Object[]) crit.uniqueResult(); // Returns Object[] ->
        CloudUsage result = new CloudUsage();
View Full Code Here

    }

    public Collection<String> getAllMacs()
    {
        Criteria criteria = getSession().createCriteria(IpPoolManagement.class);
        ProjectionList projList = Projections.projectionList();
        projList.add(Projections.property(IpPoolManagement.MAC_PROPERTY));

        criteria.setProjection(projList);
        return criteria.list();
    }
View Full Code Here

    {
        // TODO: Include aggregators functionality in bzengine?
        Session ses = HibernateEntityManagerHelper.getSession(getEntityManager());

        Criteria crit = ses.createCriteria(EnterpriseResources.class);
        ProjectionList proList = Projections.projectionList();
        proList.add(Projections.sum(EnterpriseResources.V_CPU_RESERVED_PROPERTY));
        proList.add(Projections.sum(EnterpriseResources.V_CPU_USED_PROPERTY));
        proList.add(Projections.sum(EnterpriseResources.MEMORY_RESERVED_PROPERTY));
        proList.add(Projections.sum(EnterpriseResources.MEMORY_USED_PROPERTY));
        proList.add(Projections.sum(EnterpriseResources.LOCAL_STORAGE_RESERVED_PROPERTY));
        proList.add(Projections.sum(EnterpriseResources.LOCAL_STORAGE_USED_PROPERTY));
        proList.add(Projections.sum(EnterpriseResources.PUBLIC_I_PS_RESERVED_PROPERTY));
        proList.add(Projections.sum(EnterpriseResources.PUBLIC_I_PS_USED_PROPERTY));
        proList.add(Projections.sum(EnterpriseResources.VLAN_RESERVED_PROPERTY));
        proList.add(Projections.sum(EnterpriseResources.VLAN_USED_PROPERTY));
        proList.add(Projections.sum(EnterpriseResources.EXT_STORAGE_RESERVED_PROPERTY));
        proList.add(Projections.sum(EnterpriseResources.EXT_STORAGE_USED_PROPERTY));
        proList.add(Projections.sum(EnterpriseResources.REPOSITORY_RESERVED_PROPERTY));
        proList.add(Projections.sum(EnterpriseResources.REPOSITORY_USED_PROPERTY));
        proList.add(Projections.sum(EnterpriseResources.REPOSITORY_USED_PROPERTY));

        crit.setProjection(proList);
        Object[] obj = (Object[]) crit.uniqueResult(); // Returns Object[] ->
        EnterpriseResources result = new EnterpriseResources();
View Full Code Here

        criteria.createAlias("pi.creator", "crtr");
        criteria.createAlias("ownProcessInstance", "ownPi");
        criteria.createAlias("user", "u");
        criteria.createAlias("userSubstitute", "us", CriteriaSpecification.LEFT_JOIN);
        ProjectionList pl = Projections.projectionList()
                .add(Projections.id(), "id")
                .add(Projections.property("entryDate"), "entryDate")
                .add(Projections.property("eventI18NKey"), "eventI18NKey")
                .add(Projections.property("executionId"), "executionId")
                .add(Projections.property("additionalInfo"), "additionalInfo")
View Full Code Here

    public Collection<ProcessInstance> getUserProcessesBetweenDates(UserData userData, Calendar minDate, Calendar maxDate) {
          
       long start = System.currentTimeMillis();
      Session session = getSession();
            ProjectionList properties = Projections.projectionList();
            properties.add(Projections.property("id"));
            properties.add(Projections.property("internalId"));
           Criteria criteria = session.createCriteria(ProcessInstance.class)
                    .setProjection(Projections.distinct(properties))
                    .createCriteria("processLogs");
                   
                    if(minDate!=null){
View Full Code Here

      public List<Object[]> doInHibernate(Session session)
          throws HibernateException, SQLException {

        Criteria c = session.createCriteria(TripProblemReportRecord.class);

        ProjectionList projections = Projections.projectionList();
        projections.add(Projections.rowCount());
        switch (groupBy) {
          case TRIP:
            projections.add(Projections.groupProperty("tripId.agencyId"));
            projections.add(Projections.groupProperty("tripId.id"));
            break;
          case STATUS:
            projections.add(Projections.groupProperty("status"));
            break;
          case LABEL:
            projections.add(Projections.groupProperty("label"));
            break;
        }
        c.setProjection(projections);

        addQueryToCriteria(query, c);
View Full Code Here

        criteria.add(Restrictions.eq("restaurant.id", restaurant.getId()));
        criteria.add(Restrictions.ge("date", startDate));
        criteria.add(Restrictions.le("date", endDate));

        ProjectionList projectionList = Projections.projectionList();
        projectionList.add(Projections.count("id").as("number")).add(Projections.groupProperty("status").as("status"));
        criteria.setProjection(projectionList).setResultTransformer(new AliasToBeanResultTransformer(OrderStatsDto.class));

        List<OrderStatsDto> result = criteria.list();
        Map<YFOrderState, Integer> ordersStats = new HashMap<YFOrderState, Integer>();
        for (OrderStatsDto tmp : result) {
View Full Code Here

        criteria.add(Restrictions.eq("restaurant.id", restaurant.getId()));
        criteria.add(Restrictions.ge("date", startDate));
        criteria.add(Restrictions.le("date", endDate));

        ProjectionList projectionList = Projections.projectionList();
        projectionList.add(Projections.count("id").as("number")).add(Projections.groupProperty("product").as("dish"));
        criteria.setProjection(projectionList).setResultTransformer(new AliasToBeanResultTransformer(OrderStatsDto.class));
        criteria.addOrder(Order.desc("number"));

        return criteria.list();
    }
View Full Code Here

        criteria.add(Restrictions.eq("restaurant.id", restaurant.getId()));
        criteria.add(Restrictions.ge("date", startDate));
        criteria.add(Restrictions.le("date", endDate));

        ProjectionList projectionList = Projections.projectionList();
        projectionList.add(Projections.countDistinct("uuid").as("number")).add(Projections.groupProperty("menu").as("menu"));
        criteria.setProjection(projectionList).setResultTransformer(new AliasToBeanResultTransformer(OrderStatsDto.class));
        criteria.addOrder(Order.desc("number"));

        return criteria.list();
    }
View Full Code Here

TOP

Related Classes of org.hibernate.criterion.ProjectionList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.