My appologies if this reply message was sent incomplete once already. > > How about if the Criteria had an .aggregate() method which returned > > an instance of Aggregate which had signatures for the various > > desired functions? Something like this would then be possible: > > > > Criteria criteria = session.createCriteria(Some.class) > > .add(Expression.eq("any", value); > > Aggregate aggregate = criteria.aggregate(); > > Double sum = aggregate.sum("property"); > > Double avg = aggregate.avg("property"); > > long count = aggregate.count(); // would "property" be needed here? > > List objects = criteria.list(); > > Ugly. And not very extensible.
How about getting several aggregate values in one query? Say if someone needs the sum, the average, and the maximum and minimum but they don't want to run four seperate queries. Would it be practical or feasible to do something like this? (somewhat pseudo coded): criteria.add(...Aggregate(SUM, "property")) .add(...Aggregate(AVG, "property")) .add(...Aggregate(MIN, "property")) .add(...Aggregate(MAX, "property")) ... How would the results come back though? If you call .list() on this would you then get a List of Double instances or something instead of the Class used to create the Criteria? Would you need a seperate .listAggregates() type method? __________________________________ Do you Yahoo!? Yahoo! Search - Find what you’re looking for faster http://search.yahoo.com ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel