I’m using jOOQ to get id which in MySQL is smallint unsigned primary key auto_increment
public List<Integer> getID() {
Factory sql = new Factory(Database.getInstance().connect(), SQLDialect.MYSQL);
return (List<Integer>) sql.select().from("users").fetch().getValues("id_users");
}
And go error
org.jooq.tools.unsigned.UShort cannot be cast to java.lang.Integer
Here they wrote that smallint unsigned should be cast to int.
Edit
Method should be
public List<UShort> getID() {
Factory sql = new Factory(Database.getInstance().connect(), SQLDialect.MYSQL);
return (List<UShort>) sql.select().from("users").fetch().getValues("id_users");
}
And in loop result should be cast to int.
You cannot cast UShort into Integer as it does not inherit that class. I guess you should use
UShort.intValue()to retrieve the Integer.