Can someone explain me why with Projections added to a Criteria query, you get a Object[] as a result in de List result ?
I was using the Projections this afternoon and the documentation on how to implement them are very complete, but they do not mention the processing of the result.
After some debugging I found out that it returned a Object[] in the List.
I'd suspected just a regular List to iterate, or even better: a Map .. ie:
Code:
List results = session.createCriteria(Cat.class)
.setProjection( Projections.projectionList()
.add( Projections.avg("weight").as(avgWeight" )
.add( Projections.max("weight").as(maxWeight" )
)
.list();
Map projection = (Map)results.get(0);
BigDecimal avgWeight = (BigDecimal)projection.get("avgWeight");
// etc..