Could you please post the exception stack trace? On Sep 1, 2011, at 1:58 AM, Sylwia Bugla wrote:
> Hello everyone. > I am getting desperate about this issue. I have a simple piece of code > whose purpose is to make some counts in the database. It goes like > this: > > String sql = "SELECT a.author_id X, count(*) CNT FROM > `publication_authors` a WHERE a.`cid` != 0 and a.cid = 1234 group by > a.author_id ORDER BY a.`cid` ASC"; > > SQLTemplate query = new > SQLTemplate(PublicationAuthors.class, sql); > query.setFetchingDataRows(true); > > SQLResult resultDescriptor = new SQLResult(); > resultDescriptor.addColumnResult("X"); > resultDescriptor.addColumnResult("CNT"); > query.setResult(resultDescriptor); > > List objects = context.performQuery(query); > > for(Object o: objects){ > Map dr = (Map) o; //tried with PublicationAuthors, > DataMap => always getting an exeption here "ClassCastException" > System.out.println(dr.keySet()); > } > > Could someone explain me what am I doing wrong in here? > Thanks > Sylwia >