Why does this query work normal:
Query query = session.createQuery("from Table tab");
And this query:
Query query = session
.createQuery("select tab.col1, tab.col2, tab.col3 from Table tab");
And that’s what I’m doing with both queries:
dataList = query.list();
for (Table item : dataList)
{
System.out.println(item.getCol1();
}
reports:
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to table.Table
at test.TestCriteria.main(TestCriteria.java:35)
Could you help?
Table is normally mapped in entity bean and all the columns are correct.
I believe in the second
query, the result is aList<Object[]>:I have this guess observing
Ljava.lang.Object;in the exception trace.