The ResultSet returned by Statement#getGeneratedKeys() does not support getObject(int|String, Class) unlike a normal ResultSet which does.