gpt4 book ai didi

hibernate - Grails 2.1:如何使用 “schema-export export”?

转载 作者:行者123 更新时间:2023-12-02 14:45:33 26 4
gpt4 key购买 nike

我想使用命令“schema-export”(重新)创建数据库模式。 DDL生成工作正常,但是如果执行“模式导出导出”,则会收到以下错误,这表明配置文件中缺少某些内容。

grails> dev schema-export export
| Compiling 1 source files.....
Exporting in environment 'development' for the default DataSource
| Error 2012-08-24 14:45:57,466 [main] ERROR hbm2ddl.SchemaExport - schema export unsuccessful
Message: No local DataSource found for configuration - 'dataSource' property must be set on LocalSessionFactoryBean
Line | Method
->> 61 | doCall in SchemaExport$_run_closure1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| Error 2012-08-24 14:45:57,472 [main] ERROR hbm2ddl.SchemaExport - schema export unsuccessful
Message: No local DataSource found for configuration - 'dataSource' property must be set on LocalSessionFactoryBean
Line | Method
->> 64 | doCall in SchemaExport$_run_closure1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

我的DataSource.groovy定义了一个“数据源”:
dataSource {
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
}
...
environments {
development {
dataSource {
username = "xxx"
password = "yyy"
url = "jdbc:mysql://localhost:3306/chrono_dev?autoreconnect=true"
}
}
...
}

任何建议如何解决此错误?

最佳答案

语法有点不同:

grails dev schema-export // no export

根据这个:

http://grails.org/doc/2.1.0/ref/Command%20Line/schema-export.html

如果要进行导入,则可能需要描述数据源:
grails dev schema-export export --datasource=auditing

另外,您要导入的DDL的名称是什么?

关于hibernate - Grails 2.1:如何使用 “schema-export export”?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12109862/

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