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.

hibernate class cast exception from object to ...的更多相关文章

  1. Error creating bean with name 'com.cloud.feign.interfaces.xxxFeignClient': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalSt.PathVariable annotation was empty on

    环境: Spring Cloud:Finchley.M8 Spring Boot:2.0.0.RELEASE 报错信息: Error creating bean with name 'com.clou ...

  2. Hibernate错误:Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update

    报错:Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execu ...

  3. hibernate 异常:Unexpected Exception caught setting

    异常信息:Unexpected Exception caught setting 'outHeight' on 'class com.srpm.core.project.seismicFortific ...

  4. Spring Boot启动 Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not instantiate id generator错误

    开始运行得很好的项目,因为前一天高度了项目结构和名称突然报上面的错误 查了很多网上资料很多解决方案 造成这个错误的原因有很多,例如 1.@Entity 类有变动,无非正常生成对应的数据库. 解决:使用 ...

  5. hibernate 对象状态异常:object references an unsaved transient instance - save the transient instance before flushing

    我的问题出在,删除的对象对应的表中有一个外键,关联着另外一个表,可是另外一个表中没有数据,所以报了这个错误. 参考http://www.cnblogs.com/onlywujun/archive/20 ...

  6. Exception in thread "main" org.hibernate.TransientObjectException: object references an unsaved tran

    今天在使用一对多,多对一保存数据的时候出现了这个错误 Hibernate错误: Exception in thread "main" org.hibernate.Transient ...

  7. Hibernate对substring和cast的支持问题

    http://blog.sina.com.cn/s/blog_8acd9e4b0102uwev.html Hibernate对substring和cast的支持问题 问题:要比较日期的范围...这是只 ...

  8. 10.2 Hibernate持久层

    点击项目右键->MyEclipse->Add Hibernate Capabilities 打开MyEclipse Hibernate Perspective(MyEclipse Hibe ...

  9. Hibernate使用

    实现类: public class InfoDAOImpl extends BaseDao<Info> 1.List<Object[]> midlist=super.creat ...

随机推荐

  1. [19/09/08-星期日] Python的几个概念和语法

    一.表达式.语句.程序.函数 1.表达式 就是一个类似于数学公式的东西 ,比如:10 + 5 8 - 4:表达式一般仅仅用了计算一些结果,不会对程序产生实质性的影响 如果在交互模式中输入一个表达式,解 ...

  2. Spring中的常见注解

    @Controller 标识一个该类是Spring MVC controller处理器,用来创建处理http请求的对象.   @RestController Spring4之后加入的注解,原来在@Co ...

  3. Unix时间戳和Java 的 System.currentTimeMillis()的区别

  4. 【6.10校内test】T3 加分二叉树

    加分二叉树[题目链接] 感觉我超废 这道题当时压根就不会qwq(我倒是挺适合写rand的qwq) 对于暴力的做法: 输入数据,定义数组men[i][i]=v[i](输入的第二行): dfs: dfs ...

  5. composer安装thinkphp5

    之前安装过composer,里面的一些命令符可以看看,安装tp5我也是按照文档来的,也没什么难度.但是也出现一些问题: 安装tp5: 安装在本地php环境的www目录下,通过命令窗口切换到www目录下 ...

  6. Node.js+koa2

    const Koa = require('koa') const app = new Koa() const bodyParser = require('koa-bodyparser') app.us ...

  7. object in javascript

    枚举对象属性 for....in 列举obj的可枚举属性,包括自身和原型链上的 object.keys() 只列举对象本身的可枚举属性 创建对象的几种方式 对象字面量 const pre='test' ...

  8. 洛谷 - P1522 - 牛的旅行 - Cow Tours - Floyd

    https://www.luogu.org/problem/P1522 好坑啊,居然还有直径不通过新边的数据,还好不是很多. 注意一定要等Floyd跑完之后再去找连通块的直径,不然一定是INF. #i ...

  9. 重写select

    select 模拟 目前仿写select的方式 给tableIndex 来使 div(无法获取焦点的元素)来获取元素,这样便可以在失去焦点时,是否将下拉框收回 通过 document的点击,来判断是否 ...

  10. MFC- 网络编程

    一.MFC网络编程 a)CAsyncSocket用于异步非阻塞类,用UDP通信: b)CAsyncSocket的子类(派生类):Csocket同步阻塞类,用于TCP通信: c)通信前,必须调用AfxS ...