mysql数据库 Biginteger 转换为Integer、Long类型时的错误:error提示java.math.BigInteger cannot be cast to java.lang.Integer 做项目时用到原生sql count(*)查询时出现的,记录一下方便以后参考: 解决方法如下: 现将查询的结果toString()一下,然后用Integer.valueOf()方法强转就可以了 具体实现: 代码: select count(*) from ssp_staff_station_staffs staff where staff.station_id = station.id BigInteger staffCount = getBaseDao().executeFindCount(sql); Integer countStaff = Integer.valueOf(staffCount.toString()); 小考拉图说: