if i am not do type casting to query.list(); to (List)query.list(); it gives me error like error.png and error1.pngPlease help me, I am getting this error
java.lang.ClassCastException: java.util.ArrayList cannot be cast to antlr.collections.List
on calling a method
category= new Category();
ArrayList data= (ArrayList) category.getCategoryInfo();
and method is
public List getCategoryInfo(){
Session session = HibernateUtil.openSession();
String sql = "SELECT category.id as id, category.name,c.name as parent_category FROM category join category as c on c.id=category.parent_id";
SQLQuery query = session.createSQLQuery(sql);
query.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP);
List data = (List) query.list();
return data;
}
Please help me what is wrong with this code.
List
interface. Do you know what kind ofList
is returned byquery.list();
? – Sabir Khan Feb 4 '16 at 5:46import antlr.collections.List;
in your Model? Should it bejava.util.List
? Again , Do you know what kind of List is returned by query.list();? – Sabir Khan Feb 4 '16 at 6:14