gpt4 book ai didi

mysql - Grails 没有将域类保存在正确的数据库中

转载 作者:行者123 更新时间:2023-11-29 14:10:40 25 4
gpt4 key购买 nike

我有一个 grails (2.0) 应用程序,需要从多个 MySQL 数据库获取某些信息。看在上帝的份上,我无法将域类保存在正确的数据库中。

我的 Datasource.groovy 文件是这样的:

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"
}
}

我的每个域类都这样引用它们

class Alumno {

static constraints = {
matricula blank: false
nombres blank: false
apellidos blank: false
}

static mappings = {
datasource 'alumnos'
}
}

最佳答案

在您的域类中,它应该是 mapping 而不是 mappings

static mapping = {
datasource 'alumnos'
}

关于mysql - Grails 没有将域类保存在正确的数据库中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13537947/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com