mysql数据库

Biginteger 转换为Long类型时的错误

hibernate 的createSQLQuery("select count(*) from orders").uniqueResult() 返回的对象是BigInteger类型的

BigInteger totalCount = (BigInteger)this.getSession().createSQLQuery("select count(*) from orders.orders o, customer.customer c,orders.order_logistics ol where o.customerId=c.id and ol.id=o.collectionToolSendLogisticId and o.valid=true").uniqueResult();totalCount.intValue()
totalCount.longValue()

createQuery返回的对象是Long类型的

Long totalCount = (Long)this.getSession().createQuery("select count(*) from Special s where s.valid=true").uniqueResult();

本文出自 “点滴积累” 博客,请务必保留此出处http://tianxingzhe.blog.51cto.com/3390077/1679032

java.math.BigInteger cannot be cast to java.lang.Long相关推荐

  1. [记录]java.math.biginteger cannot be cast to java.lang.long

    可以直接使用BigInteger类型进行接收, BigInteger id = (BigInteger)QueryRunner(conn,"SELECT LAST_INSERT_ID&quo ...

  2. mysql连接报java.math.BigInteger cannot be cast to java.lang.Long异常

    mysql连接报java.math.BigInteger cannot be cast to java.lang.Long异常 参考文章: (1)mysql连接报java.math.BigIntege ...

  3. mysql biginteger java_java.math.BigInteger cannot be cast to java.lang.Integer以及mysql升级的问题...

    java.math.BigInteger cannot be cast to java.lang.Integer以及mysql升级的问题 Mysql 8.0 原因是mysql升级到8.0,数据库驱动使 ...

  4. java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.Integer

    java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.Integer 1.改sql select ...

  5. Java报错:java.math.BigDecimal cannot be cast to java.lang.String

    从数据库取数字,转为string,报错: java.math.BigDecimal cannot be cast to java.lang.String 错误代码 Integer.parseInt(( ...

  6. java.math.BigDecimal cannot be cast to java.lang.Integer

    问题描述:利用sql语句从数据库里面取出数据后,对取出的数据进行数据转换时,出现了java.math.BigDecimal cannot be cast to java.lang.Integer错误, ...

  7. Hibernate原生sqlquery报错:java.math.BigDecimal cannot be cast to java.lang.Int

    hibernate使用过程中,想要自定义sql查询,自然而然得使用session.createSQLQuery(sql),但是查询的返回结果在取值时,总是会出现异常,抛出类似于: java.math. ...

  8. java biginteger转int_如何在不使用java.math.BigInteger的情况下使用Java处理非常大的数字...

    我认为程序员应该已经实现了自己的bignum库,因此欢迎在这里. (当然,稍后您会发现BigInteger更好,并且可以使用它,但这是宝贵的学习经验.) (您可以在github上关注本课程的源代码.此 ...

  9. 处理BigDecimal字段, java.math.BigDecimal cannot be cast to [Ljava.lang.Object;

    有时候写视图,里面有用到临时字段的.取出来后该字段类型为BigDecimal类型的.需要转换 我的 scoreindex为临时字段,下面这个sql语句在库里执行是没有错的.但在程序里会出错. Stri ...

  10. java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.String

    这个问题是,类型转换出错,为什么呢? 因为BigDecimal不能强制转换成 String类型,要用toString()转换.

最新文章

  1. lazyload.js详解
  2. Vivado关联第三方编辑器-Vscode
  3. unix 网络编程卷2 第43页 管道:open竟然会阻塞?
  4. c语言教程for,C语言菜鸟基础教程之for循环
  5. sql server2008 远程过程调用失败
  6. 一个C#控制台小游戏(源码解析)
  7. 【SQL注入01】SQL注入漏洞简介、原理及类型
  8. Linux下rpm软件包rpm命令的安装及卸载
  9. GTC '19 经典回顾 | 如何编排和创造二次元中的舞蹈?
  10. 高级查询组件下拉框联动(三)
  11. Elasticsearch java API (19)Percolate API
  12. Html img显示图片的三种方式
  13. 中国电信 CTWing 物联网平台运营数据大解密
  14. web中各种命令注入的检测和利用二
  15. POJ - 1375
  16. vue table自定义样式
  17. 8.Spring Boot中使用thymeleaf
  18. Storm学习入门视频教程
  19. Objective-C Memory Management For Lazy People
  20. OpenGL入门 矩阵堆栈实现简单行星系统

热门文章

  1. Atitit.http代理的实现 代码java php c# python
  2. Atitit.木马病毒的免杀原理---sikuli 的使用
  3. Atitit. visual studio vs2003 vs2005 vs2008  VS2010 vs2012 vs2015新特性 新功能.doc
  4. paip.php 5.0 5.3 5.4 5.5 -6.0的新特性总结与比较
  5. PAIP.提升安全性----COOKIE绑定IP与城市与运营商
  6. 一位创业6年CEO的忠告:不要等公司倒闭,才思考这3个问题
  7. 值得收藏!中国金融体系主要指标大全
  8. (转)嘉信理财推出全新智能投顾平台
  9. 企业如何用好云、管好云?
  10. 【优化算法】饥饿游戏搜索算法(HGS)【含Matlab源码 1802期】