hibernate class cast exception from object to ...

http://stackoverflow.com/questions/22548325/java-lang-classcastexception-cannot-be-cast-to-java-lang-integer

When you select specific columns from DB, the result you get is not the entity object, but an Object[], with each element of array holding different column values. So, what you're getting from query.list() method is: List<Object[]>. So, certainly when you cast list.get(0), to App1User, that will result in ClassCastException.

I'm falling off the sky all alone.The courage inside is gonna break the fall. Nothing can dim my light within. I am That I am 程序 = 数据结构 + 算法
posted @ 2016-01-15 17:53  IamThat  阅读(201)  评论(0编辑  收藏  举报