Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

if any one help me why i am geting following this exception here

List<abc> listQues=null;
for(int i=0;i<surveyIds.size();)
        {


            List<abc> listQue = (ArrayList<abc>) getHibernateTemplate().find("from abc as q where q.surveyId=" + surveyIds.get(0) + " order by q.pageNo asc, q.sortOrder asc");
            listQues.add((abc) listQue);


            i++;
        }

i am geting following Exception Here

java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.inrev.crm.bean.IRSurveyQuestions

Please help me

Thanks

share|improve this question
1  
Pretty simple it seems that you are getting com.inrev.crm.bean.IRSurveyQuestions type of objects but trying to cast the same to ArrayList<abc> which is an error. – SacJn yesterday
    
no bean is also abc – Shakti Sharma yesterday
    
Does not look like that. Bean class is IRSurveyQuestions. It should have been a list of abc type. – SacJn yesterday
    
i have changed bean name – Shakti Sharma yesterday
    
What is the return type of getHibernateTemplate().find()? – dimo414 yesterday
listQues.add((abc) listQue); --???

How can you cast List<abc> to abc?? Change

List<abc> listQues=null; 

to

List<List<abc>> listQues=null;

and then on the line where you are adding questions list

listQues.add(listQue);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.