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. new 和 malloc 的区别 及使用

    Malloc: 定义上:malloc  memory allocation 动态内存分配 是c中的一个函数 使用方法: extern void *malloc(unsigned int num_byt ...

  2. selectnodes和selectSingleNode

    selectnodes: selectNodes和ChildNodes获取XML内容数组的差异性 我们在使用XML进行查询或者变更数据的时候,需要注意两个很相近但结果相差很大的用法,如下: 1: Xm ...

  3. Diango路由映射FBV和CBV

    django中请求处理方式有2种:FBV(function base views) 和 CBV(class base views),换言之就是一种用函数处理请求,一种用类处理请求. FBV # url ...

  4. 2、数据类型和运算符——Java数据类型

    一.强类型语言和弱类型语言: 1.1 强类型语言 强类型语言是一种强制类型定义的语言,一旦某一个变量被定义类型,如果不经过强制转换,则它永远就是该数据类型了,强类型语言包括Java..net .Pyt ...

  5. pureftp安装

    1.下载 #cd /usr/local/src #wget http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.36.t ...

  6. 在Myeclipse下查看Java字节码指令信息

         在实际项目开发中,有时为了了解Java编译器内部的一些工作,需要查看Java文件对应的具体的字节码指令集,这里提供两种方式供参考. 一.使用javap命令      javap是JDK提供的 ...

  7. angularJS(二):作用域$scope、控制器、过滤器

    app.controller创建控制器 一.作用域 Scope(作用域) 是应用在 HTML (视图) 和 JavaScript (控制器)之间的纽带. Scope 是一个对象,有可用的方法和属性. ...

  8. AutoTikv简介

    AutoTikv是一个用于对TiKV数据库进行自动调优的工具.它的设计灵感来自于SIGMOD 2017的一篇paper:Automatic Database Management System Tun ...

  9. sublime3跳转函数

    点击Preferences->Browse Packages进入Packages目录,然后打开User目录,查看User目录里面有没有Default (Windows).sublime-mous ...

  10. Luogu P2756 [网络流24题]飞行员配对方案问题_二分图匹配题解

    二分图模板题 我用的是匈牙利 其实最大流也可以做 #include<iostream> #include<cstdio> #include<cstdlib> #in ...