daoImpl:
public List<Map> list(Dao dao, Sql sql) {
sql.setCallback(Sqls.callback.records());
dao.execute(sql);
return sql.getList(Map.class);
}
sql语句:
select f_id, f_name from t_user;
f_id是 unsigned int类型
取出后强转
(Long)map.get("f_id");
出现异常:
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
关键是有时候转 Integer也抛异常,大意是 Long不能转 Integer