public static void findDriverMonthIncome(){
String sql = "SELECT * FROM t_order";
List<Order> orders = Order.dao.find(sql);
for(Order order : orders){
System.out.println(order.getOrderId());
}
}
public static void main(String[] args) {
findDriverMonthIncome();
}
报错信息:
Exception in thread "main" java.lang.NullPointerException
at com.jfinal.plugin.activerecord.Model.find(Model.java:567)
at com.jfinal.plugin.activerecord.Model.find(Model.java:584)
at model.dao.User.findDriverMonthIncome(User.java:160)
at model.dao.User.main(User.java:167)
public List<M> find(String sql, Object... paras) {
Config config = getConfig();
Connection conn = null;
try {
conn = config.getConnection();
return find(conn, sql, paras);
} catch (Exception e) {
throw new ActiveRecordException(e);
} finally {
config.close(conn);//Model.java:567
}
}