Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要创建类似于
select obj, obj.prop.id from Object1 obj group by obj.prop.id
怎么做?
参考示例http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/querycriteria.html#querycriteria-projection
List results = session.createCriteria(Cat.class) .setProjection( Projections.projectionList() .add( Projections.rowCount() ) .add( Projections.avg("weight") ) .add( Projections.max("weight") ) .add( Projections.groupProperty("color") ) ) .list();