Hi there,
i'm rather new to hibernate and i guess my problem is somewhre explained, but i really can't find information on that.
Is there anything like a criteria API FAQ or tutorial or a more detailed documentation then part 16 of hibernate docs?
My problem is that i don't know what's inside the list that is returned by the method below that uses a ProjectionList.
In this case i have two temporary properties like "rank" and "sum(amount)", that are not in my stat class, so i guess the contents of the list will be kind of "Projection" or "ProjectionList", that provides getters for the Projections.
Would be great if someone can help me out...
Here's my code (hibernate version 3.0):
Code:
public List getTotalStats (Date d) {
Session session = HibernateUtil.currentSession();
Criteria stat = session.createCriteria(Stat.class);
stat.add(Expression.eq("date", d));
stat.setProjection(Projections.projectionList()
.add(Projections.groupProperty("site"))
.add(Projections.property("site"))
.add(Projections.rowCount(), "rank" )
.add(Projections.sum("amount"), "totalListings"));
return stat.list();
}
// that's where i'm stuck
List list = getTotalStats(mydate);
for (WhatObjectIsIt w : list) {
// get my data
}