I am getting java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to ...model.MyClassAttributes
exception at for(MyClassAttributes mc : atList)
, even if I have done a cast to the entity.
List<MyClassAttributes> atList = new ArrayList<MyClassAttributes>();
atList=(List<MyClassAttributes>)session.createSQLQuery(SELECT_QR_SQL).setLong("rec", rec).list();
for(MyClassAttributes mc : atList)
{
}
When I checked the compiled class it seems cast didnt update.
atList = session.createSQLQuery("Select col from....").setLong("rec", rec.longValue()).list();
What is the issue here?
select col1,col2 from some_table where col3=:some_val
- returns object listnew ArrayList
if you immediately replace it by the result of the other call?