Hi Chandan,

Chandan AHUJA wrote:
Hello ,
        I am very new to OJB .I have the following query .


I am using the class "ReportQueryByCriteria" and am using some "group" functions in it .
Eg .
query = new ReportQueryByCriteria(Employee.class, criteria);
query.setAttributes(new String[] { "dept__id" , "sum(age)" });
//dept__id is string , age is integer
query.addGroupBy(new String[]{ "dept__id" });
iterator = broker.getReportQueryIteratorByQuery(query);



Now please let me know when I do iterator.next() what should I cast the return object into . I have tried to cast it into (String) but it is not working and am getting classcast exception .


The documentation of queries states  following .......
"The ReportQuery returns an Iterator over a Collection of Object "


Please explain me with a code snippet .


I would expect an object array:

Object[] result = (Object[]) iterator.next();
String deptId = (String) result[0];
// I'm not sure sure how 'sum' will be mapped, maybe
// it's String too, but I expect Integer
Integer ageSum = (Integer) result[1];

regards,
Armin


Thanks

Chandan .



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to