1
votes

I want to add other datasource to use with 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
    }
}

But already have a lot of domain classes and I no have time to define static mapping in each one.

Domain.groovy

static mapping {
    datasource 'ALL'
}

Is posible to configurate grails to set datasource 'ALL' for all domains?

1

1 Answers

2
votes

You can add something like this to grails-app/conf/application.groovy

grails.gorm.default.mapping = {
    datasource 'ALL'
}

See the documentation for Grails mappings.