AbstractMethodError on resultset.getObject

亡梦爱人 提交于 2019-12-01 18:07:36

The method ResultSet.getObject(String columnLabel, Class<T> type) was added in JDBC 4.1 (Java 7). It looks like you are using a JDBC 4.0 driver, and not a JDBC 4.1 (or JDBC 4.2/Java 8) driver.

You may need to update your JDBC driver (the latest for Connector/J MySQL driver is 5.1.38).

Ok Sorry about the Question I have Rethought my approach. Instead of using reflection to set the types of the class members, I have just impletented a method in each data model class that maps ResultSet values to the current object.

@Override
public Select load(ResultSet rs) throws SQLException {
    this.id = rs.getInt("id");
    this.name = rs.getString("name");
    this.uuid = rs.getString("uuid");
    this.chunkX = rs.getInt("chunkX");
    this.chunkZ = rs.getInt("chunkZ");
    this.blockX = rs.getInt("blockX");
    this.blockY = rs.getInt("blockY");
    this.blockZ = rs.getInt("blockZ");
    return this;
};

As for my initial issue using reflection I dont know why it was failing.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!