Пример #1
0
  /** 配置插件 */
  public void configPlugin(Plugins me) {

    // 配置C3p0数据库连接池插件
    C3p0Plugin c3 =
        new C3p0Plugin(getProperty("url"), getProperty("username"), getProperty("password").trim());
    c3.setDriverClass(getProperty("driverClassName"));
    me.add(c3);

    // 配置ActiveRecord插件

    ActiveRecordPlugin arp = new ActiveRecordPlugin(c3);
    arp.addMapping("kk_product", Goods.class);
    arp.addMapping("kk_manager", Manager.class);
    arp.addMapping("kk_res", Res.class);
    arp.addMapping("kk_user", User.class);
    arp.addMapping("kk_shop", Shop.class);
    arp.addMapping("kk_product_img", GoodsImg.class);
    arp.addMapping("kk_order", Order.class);
    arp.addMapping("kk_order_cache", OrderCache.class);
    arp.addMapping("kk_product_fb", FBGoods.class);
    arp.setShowSql(false);
    me.add(arp);

    // 配置极光推送插件
    JPush jpush = new JPush();
    me.add(jpush);
  }
Пример #2
0
 /** 初始化数据库 */
 public void initDb() {
   // 配置C3p0数据库连接池插件
   C3p0Plugin C3p0Plugin = createC3p0Plugin();
   C3p0Plugin.start();
   // 配置ActiveRecord插件
   ActiveRecordPlugin arp = new ActiveRecordPlugin(C3p0Plugin);
   // 所有配置在 MappingKit 中搞定
   _MappingKit.mapping(arp);
   arp.start();
 }