MySQL: ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long – Fix

The problem seems with versions of MySQL in combination with old version of mysql-connector.jar. Just tried with below mysql-connector.jar version with MySQL 8.0 and seems to work for me perfectly.

	<relativePath /> <!-- lookup parent from repository -->

If you’re encountering a ClassCastException in a MySQL context where a java.math.BigInteger cannot be cast to java.lang.Long, it could be due to the types of columns or values being retrieved from the database.

MySQL uses BIGINT to represent large integer values, and the JDBC driver may return BigInteger for these values. If your code is expecting a Long and directly trying to cast, it can lead to a ClassCastException.