Package org.hibernate.criterion

Examples of org.hibernate.criterion.ProjectionList


                criteria.add(Expression.eq("nodeId", nodeId));

                criteria.add(Expression.eq("alive", java.lang.Boolean.TRUE));

                ProjectionList prolist = Projections.projectionList();
                prolist.add(Projections.rowCount());
                criteria.setProjection(prolist);

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


                Criterion cri2 = Expression.eq("state", new Integer(ITaskInstance.COMPLETED));

                criteria.add(cri2);

                ProjectionList prolist = Projections.projectionList();
                prolist.add(Projections.rowCount());
                criteria.setProjection(prolist);

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

                Criterion cri2 = Expression.eq("state", new Integer(ITaskInstance.RUNNING));
                Criterion cri_or = Expression.or(cri1, cri2);

                criteria.add(cri_or);

                ProjectionList prolist = Projections.projectionList();
                prolist.add(Projections.rowCount());
                criteria.setProjection(prolist);

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

                Criterion cri_or = Expression.or(cri1, cri2);
//              Criterion cri_or = Expression.or(cri_tmp, cri3);

                criteria.add(cri_or);

                ProjectionList prolist = Projections.projectionList();
                prolist.add(Projections.rowCount());
                criteria.setProjection(prolist);

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

          //      c1.setProjection(Projections.property("username"));
          //      c1.setProjection(Projections.property("address"));
    int len=s.length;
    System.out.println(len);
   
    ProjectionList p1=Projections.projectionList();        
    for(int i=0; i<len; i++)
    {
                 p1.add(Projections.property(s[i]));
                 System.out.println(s[i]);
                
          //        p1.add(Projections.property("address"));
    }          
                 
View Full Code Here

    Session session=s1.openSession();
    //processor p=new processor();

   
    Criteria criteria=session.createCriteria(osvo.class);
    ProjectionList p=Projections.projectionList();
    //p.add(Projections.property("osname"));
    p.add(Projections.groupProperty("osname"));
    p.add(Projections.rowCount());
    criteria.setProjection(p);
   
   
 
    List l1 =  criteria.list();
View Full Code Here

    Session session=s1.openSession();
    //select os.osname id.name from machine id, osvo so
    Criteria criteria = session.createCriteria(osvo.class, "os");
    criteria.createAlias("os.machineid", "id", Criteria.INNER_JOIN);
   
    ProjectionList p=Projections.projectionList();
   
    p.add(Projections.property("id.name"));
    p.add(Projections.property("osname"));
    criteria.setProjection(p);
    List l1 =  criteria.list();
    Gson gson = new Gson();
         String record = gson.toJson(l1);
         System.out.println("record in json = " + record);
View Full Code Here

    Criteria c1=session.createCriteria(login.class);
  //  c1.add(Restrictions.and(Restrictions.eq("id", new Integer(0)),Restrictions.like("username","vipul")));
  //  c1.addOrder(Order.desc("id"));
  //  c1.setProjection(Projections.property("username"));
  //  c1.setProjection(Projections.property("address"));
    ProjectionList p1=Projections.projectionList();
    p1.add(Projections.property("username"));
    p1.add(Projections.property("address"));
   
   
    c1.setProjection(p1);
   
    List l1 = (List) c1.list();
View Full Code Here

          //      c1.setProjection(Projections.property("username"));
          //      c1.setProjection(Projections.property("address"));
    int len=s.length;
    System.out.println(len);
   
    ProjectionList p1=Projections.projectionList();        
    for(int i=0; i<len; i++)
    {
                 p1.add(Projections.property(s[i]));
                 System.out.println(s[i]);
                
          //        p1.add(Projections.property("address"));
    }          
                 
View Full Code Here

    conj.add(Restrictions.ne("tipoMovimento", tipoMovimento));
    conj.add(Restrictions.eq("legalEntity", legalEntity));
    conj.add(Restrictions.eq("organizationUnit", organizationUnit));
    criteria.add(conj);

    ProjectionList proList = Projections.projectionList();
    proList.add(Projections.groupProperty("dataRegistrazione"));
    proList.add(Projections.groupProperty("codiceSocietaVeicolo"));
    proList.add(Projections.sum("importoDare"));
    proList.add(Projections.sum("importoAvere"));

    criteria.setProjection(proList);

    List<?> result = getHibernateTemplate().findByCriteria(criteria);
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.