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
.