Grails error: table or view does not exist

Grails error: table or view does not exist

每当我启动我的 Grails 应用程序时,我的所有域都会出现这些错误 类。

ERROR hbm2ddl.SchemaExport  - HHH000389: Unsuccessful: drop table domain_class cascade constraints
ERROR hbm2ddl.SchemaExport  -ORA-01031: insufficient privileges

然后

ERROR hbm2ddl.SchemaExport  -ORA-00942: table or view does not exist

我正在为应用程序使用内存数据库,我的 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'
}
// 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"
        }
    }

是不是DataSource设置有问题? 我用 grails -Dgrails.env=local run-app -https

开始我的申请

我尝试在启动期间使用 BootStrap.groovy 创建对象,但它们都失败了。我使用 GGTS 进行开发。这是什么特权?

我们找到了答案。资源文件夹中文件 instanceConfig.local.properties 中的 dataSource 指向一个 Oracle 数据库,我没有配置角色来在那里创建或删除表。因此出现权限不足错误。

尽管 DataSource.groovy 具有内存数据库设置,但我认为 instanceConfig.local.properties 会覆盖它。无论如何,谢谢你们的帮助!