java.math.BigInteger cannot be cast to java.lang.Integer
来源:互联网 发布:单片机课后答案霍孟友 编辑:程序博客网 时间:2024/04/28 04:09
异常:java.math.BigInteger cannot be cast to java.lang.Integer
原因:BigInteger是大数据无法转换成Integer
解决方案:
1、java.lang.Object java.lang.Object
java.lang.Number java.lang.Number
java.math.BigInteger java.lang.Integer
可以看出都继承自java.lang.Number,所以可以用Number作为中间人进行转换
2、修改数据库字段长度
以MySQL为例,int类型的长度经常被设置为11,如果用Hibernate则会自动给你转成Integer,这时可以接收不会报错;若以原生SQL查询,则会报不能转换的错误,所以需要把长度设置的小点就会避免该错误,例如 int(4),再次运行就不会报错!
0 0
- java.math.BigInteger cannot be cast to java.lang.Integer
- java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Integer
- java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Integer
- java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Integer
- java.math.BigInteger cannot be cast to java.lang.Long
- java.math.BigInteger cannot be cast to java.lang.Long
- java.math.BigInteger cannot be cast to java.lang.Long
- Could not write JSON: java.lang.Integer cannot be cast to java.math.BigInteger
- 关于java.math.BigInteger cannot be cast to java.lang.Integer小方法
- java.math.BigDecimal cannot be cast to java.lang.Integer
- java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Integerjava.lang.Clas
- 十三、java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
- hibernate:java.math.BigInteger cannot be cast to java.lang.Long
- 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
- 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
- 一次泛型引起的意外:java.math.BigDecimal cannot be cast to java.lang.Integer
- linux下查看网卡的速度-dmesg的应用
- linux防火墙相关操作
- JS和JQUERY有关下拉框的操作
- jee数据传递中文乱码
- 设计模式06_桥接模式
- java.math.BigInteger cannot be cast to java.lang.Integer
- DEV GridControl一些属性配置--40开始为原创
- django restful api
- WindowsNT/2000的系统日志文件
- Android如何在http头信息里设置参数
- 慕课网二次学习(六)
- Opencv 中的函数不起作用
- Sql Server优化之路
- Sizeof与Strlen的区别与联系