如果我有两个数据源:dataSource_1
和dataSource_2
。我如何在运行时根据条件设置数据源 - 例如谁登录?
environments {
development {
dataSource_1 {
dbCreate = "create-drop"
url = "jdbc:h2:mem:devDb"
}
dataSource_2 {
dialect = org.hibernate.dialect.MySQLInnoDBDialect
driverClassName = 'com.mysql.jdbc.Driver'
username = 'lookup'
password = 'secret'
url = 'jdbc:mysql://localhost/lookup'
dbCreate = 'update'
}
}
}