Here is my code given below I'm not able to fetch records from my Transaction table as it displays error--java.lang.ClassCastException Ljava.lang.Object cannot be cast to com.infotech.model.Transaction
Help me out where is the issue Note- Transaction is my class
ArrayList<Transaction> arr1 = null;
Transaction tt1=null;
try{
SessionFactory sessionfactory = new Configuration().configure().buildSessionFactory();
Session session = sessionfactory.openSession();
session= sessionfactory.openSession();
session.beginTransaction();
int uid = search.getUser_id();
Query query1=session.createQuery("select A_no, date, type, B_id from Transaction t where t.user_id=:uid");
query1.setInteger("uid", uid);
List<Transaction> list=query1.list();
Iterator<Transaction> itr1=list.iterator();
arr1=new ArrayList<Transaction>();
while(itr1.hasNext())
{
tt1=itr1.next();
arr1.add(tt1);
System.out.println(tt1.getA_no()+"\t"+tt1.getB_id());
}
}catch(Exception ex){ex.printStackTrace();}
ModelAndView m=new ModelAndView("form-search","data",tt);
m.addObject("copy", arr1);