hibernate class cast exception from object to ...
2016-01-15 17:53
483 查看
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
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.
相关文章推荐
- Java提高学习之Object(2)
- Java提高学习之Object类详解(1)
- Java Object...可变长度的参数(Varargs)详解
- Objective-C属性特性
- Objective-C KVC和KVO的使用
- Swift 懒加载(lazy) 和 Objective-C 懒加载的区别
- 浅谈Scala 2.8的包对象(package object)
- Object-C--->Swift之(四)强大的Switch
- xjc-beyond sliding windows-Object Localization by Efficient Subwindow Search 论文的算法和知识点
- json字符串转换为JSONObject和JSONArray
- Qt QObject
- 在Swift中,如何像Objective-C定义可选接口?
- Objective-C中使用不定参数个数的方法调用
- FLASH动画-- SWFObject
- Objective-c学习日总结之与C的区别及类与对象的定义,类的声明及调用方法
- Swift语言调用Objective-c
- Thinking in Java,Fourth Edition(Java 编程思想,第四版)学习笔记(十一)之Holding Your Objects
- PHP“Cannot use object of type stdClass as array”
- id和instancetype和NSObject
- iPhone/Mac Objective-C 内存管理教程和原理剖析 [转]