问题描述
错误hbm2ddl.SchemaExport - 当您启动我的Grails应用程序时, HHH000389:不成功:drop table domain_class级联约束
错误hbm2ddl.SchemaExport -ORA-01031:权限不足
然后
错误hbm2ddl.SchemaExport -ORA-00942:表或视图不存在
code>
我正在为应用程序使用内存数据库,而我的DataSource.groovy包含它:
dataSource {
pooled = true
driverClassName =org.h2.Driver
username =sa
password =
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class ='net.sf. ehcache.hibernate.EhCacheRegionFactory'
}
//环境特定设置
环境{
本地{
数据来源{
dbCreate =create-drop//创建','创建'','更新','验证',''
url =jdbc:h2:mem: devDb; MVCC = TRUE; LOCK_TIMEOUT = 10000
}
开发{
dataSource {
dbCreate =update//'create',' '
url =jdbc:h2:mem:devDb; MVCC = TRUE; LOCK_TIMEOUT = 10000
}
} $ b创建删除','更新','验证' $ b test {
dataSource {
dbCreate =update
url =jdbc:h2:mem:testDb; MVCC = TRUE; LOCK_TIMEOUT = 10000
}
}
DataSource中的设置有问题吗?
我使用 grails -Dgrails.env = local run-app -https
开始申请尝试使用BootStrap.groovy在启动过程中创建对象,甚至失败。我使用GGTS进行开发。这是什么特权呢?
我们找到了答案。 resources文件夹中的文件 instanceConfig.local.properties
中的 dataSource
指向Oracle数据库,我没有配置到在那里创建或删除表的角色。因此,特权错误不足。尽管 DataSource.groovy
具有内存数据库设置,但我认为
会覆盖它。感谢帮助家伙!
c> instanceConfig.local.properties
When ever I start my Grails application, I get these errors for all my domain classes.
ERROR hbm2ddl.SchemaExport - HHH000389: Unsuccessful: drop table domain_class cascade constraints
ERROR hbm2ddl.SchemaExport -ORA-01031: insufficient privileges
and then
ERROR hbm2ddl.SchemaExport -ORA-00942: table or view does not exist
I am using in-memory database for the application and my DataSource.groovy has this in it:
dataSource {
pooled = true
driverClassName = "org.h2.Driver"
username = "sa"
password = ""
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
// environment specific settings
environments {
local {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
}
}
development {
dataSource {
dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
}
}
Is there something wrong with the settings in DataSource?I start my application with grails -Dgrails.env=local run-app -https
I tried to create objects during startup using BootStrap.groovy and even they fail. I use GGTS for development. What privileges is this talking about?
We found the answer. The dataSource
in file instanceConfig.local.properties
in the resources folder was pointing to an Oracle database and I am not configured to a role to create or drop tables there. Hence the insufficient privileges error.
Even though the DataSource.groovy
had the in-memory database setting, I assume that the instanceConfig.local.properties
overrides it. Thanks anyways for the help guys!
这篇关于Grails错误:表或视图不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!