本文整理汇总了Java中com.jfinal.plugin.c3p0.C3p0Plugin类的典型用法代码示例。如果您正苦于以下问题:Java C3p0Plugin类的具体用法?Java C3p0Plugin怎么用?Java C3p0Plugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
C3p0Plugin类属于com.jfinal.plugin.c3p0包,在下文中一共展示了C3p0Plugin类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configPlugin
import com.jfinal.plugin.c3p0.C3p0Plugin; //导入依赖的package包/类
public void configPlugin(Plugins me) {
// 配置C3p0数据库连接池插件
C3p0Plugin c3p0Plugin = new C3p0Plugin(PropKit.get("jdbcUrl"), PropKit.get("user"), PropKit.get("password").trim());
me.add(c3p0Plugin);
// 配置ActiveRecord插件
ActiveRecordPlugin arp = new ActiveRecordPlugin(c3p0Plugin);
me.add(arp);
// EhCachePlugin ecp = new EhCachePlugin();
// me.add(ecp);
arp.addMapping("wechat_sys_user", SysUser.class);//映射wechat_sys_user表到SysUser模型(映射名字必须与数据库表名一致)
arp.addMapping("wechat_sys_log", Logs.class);
arp.addMapping("wechat_user_info", UserInfo.class);
arp.addMapping("wechat_public_account", PublicAccount.class);
arp.addMapping("wechat_req_msg_log", ReqMsgLog.class);
arp.addMapping("wechat_material", Material.class);
}
示例2: configPlugin
import com.jfinal.plugin.c3p0.C3p0Plugin; //导入依赖的package包/类
@Override
public void configPlugin(Plugins plugin) {
loadPropertyFile("jdbc.properties");
/**
* 配置Mysql支持
*/
// 配置c3p0数据库连接池插件
C3p0Plugin cp = new C3p0Plugin(getProperty("mysql.jdbcUrl"), getProperty("mysql.user"), getProperty("mysql.password"));
plugin.add(cp);
// 配置ActiveRecord插件
ActiveRecordPlugin arp = new ActiveRecordPlugin(cp);
plugin.add(arp);
// 映射table到model
arp.addMapping("test_blog", Blog.class);
/**
* 配置Oracle支持
*/
/*// 配置c3p0数据库连接池插件
C3p0Plugin cp = new C3p0Plugin(getProperty("oracle.jdbcUrl"), getProperty("oracle.user"), getProperty("oracle.password"));
cp.setDriverClass(getProperty("jdbcDriver")); // 配置Oracle驱动
plugin.add(cp);
// 配置ActiveRecord插件
ActiveRecordPlugin arp = new ActiveRecordPlugin(cp);
plugin.add(arp);
arp.setDialect(new OracleDialect()); // 配置Oracle方言
arp.setContainerFactory(new CaseInsensitiveContainerFactory()); // 配置属性名(字段名)大小写不敏感容器工厂
// 映射table到model
arp.addMapping("TEST_BLOG","ID", Blog.class);*/
}
示例3: configPlugin
import com.jfinal.plugin.c3p0.C3p0Plugin; //导入依赖的package包/类
@Override
public void configPlugin(Plugins me)
{
C3p0Plugin c3p0Plugin = new C3p0Plugin(getProperty("mysql_url"), getProperty("mysql_username"), getProperty("mysql_password"));
me.add(c3p0Plugin);
ActiveRecordPlugin arp = new ActiveRecordPlugin(c3p0Plugin);
me.add(arp);
}
示例4: configPlugin
import com.jfinal.plugin.c3p0.C3p0Plugin; //导入依赖的package包/类
public void configPlugin(Plugins me) {
// 配置缓存插件
EhCachePlugin ecp = new EhCachePlugin();
me.add(ecp);
// 配置C3p0数据库连接池插件
C3p0Plugin c3p0Plugin = new C3p0Plugin(getProperty("jdbcUrl"),
getProperty("userName"), getProperty("password").trim());
me.add(c3p0Plugin);
// 配置ActiveRecord插件
ActiveRecordPlugin arp = new ActiveRecordPlugin(c3p0Plugin);
me.add(arp);
//Model自动绑定
AutoTableBindPlugin atbp = new AutoTableBindPlugin(c3p0Plugin);
me.add(atbp);
// 配置任务
Cron4jPlugin cron4jPlugIn = new Cron4jPlugin();
me.add(cron4jPlugIn);
// sqlXml
SqlInXmlPlugin sqlInXmlPlugin = new SqlInXmlPlugin();
me.add(sqlInXmlPlugin);
}
示例5: configPlugin
import com.jfinal.plugin.c3p0.C3p0Plugin; //导入依赖的package包/类
/**
* 配置插件
*/
@Override
public void configPlugin(Plugins me) {
c3p0Plugin = new C3p0Plugin(getProperty("jdbcUrl"), getProperty("user"), getProperty("password").trim());
me.add(c3p0Plugin);
ActiveRecordPlugin arp = new ActiveRecordPlugin(c3p0Plugin);
arp.addMapping("re_student", ReStudent.class);
arp.addMapping("re_class", ReClass.class);
arp.addMapping("re_rmb", ReRMB.class);
arp.addMapping("re_admin", AdminUser.class);
me.add(arp);
}
示例6: configPlugin
import com.jfinal.plugin.c3p0.C3p0Plugin; //导入依赖的package包/类
@Override
public void configPlugin(Plugins me) {
C3p0Plugin cp = new C3p0Plugin(getProperty("jdbcUrl"), getProperty("user"), getProperty("password"));
me.add(cp);
ActiveRecordPlugin arp = new ActiveRecordPlugin(cp);
me.add(arp);
arp.addMapping("bee_users", UserModel.class);
arp.addMapping("bee_tasks",TasksModel.class);
arp.addMapping("bee_projects",ProjectModel.class);
arp.addMapping("bee_logs",LogsModel.class);
arp.addMapping("bee_weekplan", WeekPlanModel.class);
}
示例7: getActiveRecordPlugin
import com.jfinal.plugin.c3p0.C3p0Plugin; //导入依赖的package包/类
/**
* 配置JFinal提供过简易版本的ORM(其实这里是叫Active+Record)。
*
* @param c3p0Plugin
* @return
*/
private ActiveRecordPlugin getActiveRecordPlugin(C3p0Plugin c3p0Plugin) {
ActiveRecordPlugin arp = new ActiveRecordPlugin("c3p0Plugin" + new Random().nextInt(), c3p0Plugin);
arp.addMapping("user", "userId", User.class);
arp.addMapping("log", "logId", Log.class);
arp.addMapping("type", "typeId", Type.class);
arp.addMapping("link", "linkId", Link.class);
arp.addMapping("comment", "commentId", Comment.class);
arp.addMapping("lognav", "navId", LogNav.class);
arp.addMapping("website", "siteId", WebSite.class);
arp.addMapping("plugin", "pluginId", Plugin.class);
arp.addMapping("tag", "tagId", Tag.class);
return arp;
}
示例8: start
import com.jfinal.plugin.c3p0.C3p0Plugin; //导入依赖的package包/类
public static void start() {
c3p0Plugin = new C3p0Plugin(AppConfig.db.jdbcUrl, AppConfig.db.username, AppConfig.db.password);
c3p0Plugin.setDriverClass(AppConfig.db.driverClass);
c3p0Plugin.start();
activeRecordPlugin = new ActiveRecordPlugin(c3p0Plugin);
activeRecordPlugin.setDialect(new MysqlDialect());
activeRecordPlugin.addMapping("user", User.class);
activeRecordPlugin.addMapping("user_detail", UserDetail.class);
activeRecordPlugin.addMapping("admin", Admin.class);
activeRecordPlugin.addMapping("crash_log", CrashLog.class);
activeRecordPlugin.addMapping("advice", Advice.class);
activeRecordPlugin.start();
}