I have a grails (2.0) application that needs to get certain information from multiple MySQL databases. I can’t for the love of God get it to save the domain class in the proper database.
My Datasource.groovy File is something like this:
environments {
development {
dataSource {
dbCreate = "create-drop"
url = "jdbc:mysql://localhost:3306/informacion_empleados_dev"
}
dataSource_signOn {
driverClassName = "com.mysql.jdbc.Driver"
username = "root"
password = ""
dbCreate = "create-drop"
url = "jdbc:mysql://localhost:3306/sign_on"
}
dataSource_administradores {
driverClassName = "com.mysql.jdbc.Driver"
username = "root"
password = ""
dbCreate = "create-drop"
url = "jdbc:mysql://localhost:3306/administradores"
}
dataSource_docentes {
driverClassName = "com.mysql.jdbc.Driver"
username = "root"
password = ""
dbCreate = "create-drop"
url = "jdbc:mysql://localhost:3306/docentes"
}
dataSource_alumnos {
driverClassName = "com.mysql.jdbc.Driver"
username = "root"
password = ""
dbCreate = "create-drop"
url = "jdbc:mysql://localhost:3306/alumnos"
}
}
And each of my domain classes references them as this
class Alumno {
static constraints = {
matricula blank: false
nombres blank: false
apellidos blank: false
}
static mappings = {
datasource 'alumnos'
}
}
In your domain class, it should be
mappingnotmappings