I use the Hibernate (3.2) criteria to query, and this gives me an exception when converting to a list.
See my code and exception below:
List<Summary> summaryList;
Criteria criteria = session.createCriteria(Summary.class);
session.beginTransaction();
summaryList = Criteria.setProjection(
Projections.projectionList().add(Projections.sum("contractDollar"))
.add(Projections.groupProperty("department"))).list() ;
exception: java.lang.ClassCastException: [Ljava.lang.Object; cannot be added to com.abc.model.Summary
I am not sure why the result is returned as an “Object”, although I indicated it as my pojo (Summary)
Could you help me with this. I'm new to hibernation.
Thanks, Raj.
source
share