codecamp

注解方式指定数据源

可以在实体类名上使用如下方式指定使用的数据源名称

import org.jfaster.annotation.DataSource;

@DataSource(name="mysqlTest")
public class TestUser 
{
     //TODO
}

数据源的名称就是在jfaster.properties中配置的数据源配置前缀名,如下

mysqlTest.jdbc.driver=com.mysql.jdbc.Driver
mysqlTest.jdbc.url=jdbc:mysql://127.0.0.1:3306/test
mysqlTest.jdbc.username=root
mysqlTest.jdbc.password=123456

在实体类名上面指定数据源名称时,则会以连接池方式构建连接

数据源如果集成spring使用的话,数据源名称也一样可以是spring容器中的数据源名称【参看集成Spring】



ORM映射API管理查看
连接池配置
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }