【发布时间】:2015-12-11 20:49:32
【问题描述】:
我想添加其他数据源以与 GORM 一起使用。
DataSource.groovy
development {
dataSource {
dbCreate = "update"
driverClassName = "org.postgresql.Driver"
username = "usrcastor"
url = "jdbc:postgresql://localhost:5432/dbcastor_master"
password = "castor"
dialect = net.sf.hibernate.dialect.PostgreSQLDialect
pooled = true
loggingSql = false
}
dataSource_otherDataSource {
dbCreate = "update"
driverClassName = "org.postgresql.Driver"
username = "usrcastor"
url = "jdbc:postgresql://localhost:5432/dbcastor_child_a"
password = "castor"
dialect = net.sf.hibernate.dialect.PostgreSQLDialect
pooled = true
loggingSql = false
}
}
但是已经有很多领域类,我没有时间在每个类中定义静态映射。
Domain.groovy
static mapping {
datasource 'ALL'
}
是否可以配置 grails 为所有域设置数据源“ALL”?
【问题讨论】:
标签: grails grails-orm