Hibernate version:3rc
Sorry for this question, but i don't understand one thing.
if you can look my code, i can't use "aggregation hql" and to cast into my object[]?, because i think, Hibenernate not know the set/get method for "sum(ay.qtavdi)";
There is a method for to do aggregation without hql and to use my Object, how for example "select"?
I hope to write correct my question, can you help me?
Devis
Quote:
public CVenditaVO[] Categoria(String shop,String data)
{
try {
if(data.length()==10)
{
String aa = data.substring(6, 10);
String mm = data.substring(3, 5);
String gg = data.substring(0, 2);
data=aa+"-"+mm+"-"+gg;
}
Session session = AS400Session.currentSession();
Query sql = session.createQuery(
"Select ay.modevo.cdc_cmpf,ay.modevo.dsc_cmpf,sum(ay.qtavdi) from CVenditaVO as ay where ay.pk.shopdi=? and ay.pk.datadi=? Group by ay.modevo.cdc_cmpf,ay.modevo.dsc_cmpf");
sql.setString(0, shop);
sql.setDate(1, java.sql.Date.valueOf(data));
ArrayList list = new ArrayList();
list = (ArrayList) sql.list();
CVenditaVO vos[] = new CVenditaVO[list.size()];
list.toArray(vos);
session.connection().commit();
AS400Session.closeSession();
return vos;
}
catch (Exception ex) {
AS400Session.RollBack();
log.fatal(ex.getMessage());
throw new java.lang.UnsupportedOperationException(
"Method selectReso " + ex.getMessage());
}
finally {
AS400Session.closeSession();
}