com.jfinal.plugin.activerecord.IDataSourceProvider Java Examples

The following examples show how to use com.jfinal.plugin.activerecord.IDataSourceProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ZrLogConfig.java    From zrlog with Apache License 2.0 5 votes vote down vote up
/**
 * 配置JFinal提供过简易版本的ORM(其实这里是叫Active+Record)。
 *
 * @param dataSourceProvider
 * @return
 */
private ActiveRecordPlugin getActiveRecordPlugin(IDataSourceProvider dataSourceProvider) {
    ActiveRecordPlugin arp = new ActiveRecordPlugin("c3p0Plugin" + new Random().nextInt(), dataSourceProvider);
    arp.addMapping(User.TABLE_NAME, "userId", User.class);
    arp.addMapping(Log.TABLE_NAME, "logId", Log.class);
    arp.addMapping(Type.TABLE_NAME, "typeId", Type.class);
    arp.addMapping(Link.TABLE_NAME, "linkId", Link.class);
    arp.addMapping(Comment.TABLE_NAME, "commentId", Comment.class);
    arp.addMapping(LogNav.TABLE_NAME, "navId", LogNav.class);
    arp.addMapping(WebSite.TABLE_NAME, "siteId", WebSite.class);
    arp.addMapping(Plugin.TABLE_NAME, "pluginId", Plugin.class);
    arp.addMapping(Tag.TABLE_NAME, "tagId", Tag.class);
    return arp;
}
 
Example #2
Source File: SnakerPlugin.java    From snakerflow with Apache License 2.0 2 votes vote down vote up
/**
 * 根据数据源提供者构造插件
 * @param dataSourceProvider 数据源提供接口
    * @param properties 属性
 */
public SnakerPlugin(IDataSourceProvider dataSourceProvider, Properties properties) {
	SnakerPlugin.dataSourceProvider = dataSourceProvider;
       SnakerPlugin.properties = properties;
}