jfinal main 链接数据源

public static void main(String[] args) {

    C3p0Plugin cp = new C3p0Plugin("jdbc:mysql://localhost/safe", "root", "root");
    cp.start();
    ActiveRecordPlugin arp = new ActiveRecordPlugin(cp);
   arp.start();
  arp.addMapping("driver", Driver.class);
  List<Driver> drivers = Driver.dao.find("select * from driver limit 0,20");
  for(Driver d:drivers){
    Set<Entry<String, Object>> set = d.getAttrsEntrySet();
    Iterator<Entry<String, Object>> it = set.iterator();
    System.out.println("=================");
    while(it.hasNext()){
      Entry<String, Object> next = it.next();
      System.out.println(next.getKey()+":"+next.getValue());
    }

    System.out.println("=================");
  }

}
原文地址:https://www.cnblogs.com/phyxis/p/5595854.html