I am getting data from a database. I am getting classcastexception. In database my id is saved as BIGINT but in code(object) it is long. Is there is any problem while casting bigint to long?
have you tried casting your value to BigInteger first and then get the long value with longValue()? It should work. And aioobe is right, check for null values also.
cheers!
If this is MySql, you should probably use java.math.BigDecimal
.
See the table at Java, JDBC and MySQL Types.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With