Set Multiple projections
ProjectionList p1 = Projections.projectionList();
p1.add(<projection1>);
p1.add(<Projection2>);
c.setProjection(p1);
Crietria c = session.createCriteria(Person.class);
c.add( Restrictions.like("city","AGRA") );
c.add( Restrictions.gt("age",60) );
c.addOrder( Order.asc("name") );
ProjectionList p1 = Projections.projectionList();
p1.add(Projections.property("name"));
p1.add(Projections.property("address"));
c.setProjection(p1);
List result = c.list();
No comments:
Post a Comment
Note: only a member of this blog may post a comment.