代码如下:
StringBuffer sbSql = new StringBuffer();
sbSql.append("select *");
sbSql.append(" from mv_qizhou_search q ");
Sql sql = Sqls.queryEntity(sbSql.toString());
sql.setCallback(new SqlCallback() {
@Override
public Object invoke(Connection conn, ResultSet rs, Sql sql)
throws SQLException {
List<JSONObject> list = new ArrayList<JSONObject>();
while (rs.next()) {
JSONObject obj = new JSONObject();
obj.put("id", rs.getString("id"));
obj.put("oldThumb", rs.getString("oldThumb"));
obj.put("oldUrl", rs.getString("oldUrl"));
obj.put("oldSmall", rs.getString("oldSmall"));
list.add(obj);
}
return list;
}
});
** dao.execute(sql);**
sql.getList(JSONObject.class);
执行中,加粗的地方报错。org.nutz.dao.DaoException: net.sf.json.JSONException: java.lang.reflect.InvocationTargetException
应该是jsonObject,没有反射成功。