gpt4 book ai didi

grails - 在Grails中找不到表 “XXX”

转载 作者:行者123 更新时间:2023-12-02 14:41:11 24 4
gpt4 key购买 nike

尝试导入旧的grails项目时,映射似乎存在问题。一切都完美加载,直到...

Server running. Browse to http://localhost:8080/prmptvServer
Configuring Spring Security Core ...
... finished configuring Spring Security Core

| Error 2015-11-30 09:06:43,636 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - HHH000389: Unsuccessful: alter table bank_account drop constraint FK_ss4uej5gx2a07srb540l15s21 if exists
| Error 2015-11-30 09:06:43,638 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - Table "BANK_ACCOUNT" not found; SQL statement: alter table bank_account drop constraint FK_ss4uej5gx2a07srb540l15s21 if exists [42102-176]

其他域也无法加载。据我了解,如果我的数据源包含

dbCreate="create-drop"



,每次重新启动应用程序时都应该重建数据库,不是吗?至少那是我记得的。因此,如果找不到该表,是否没有创建该表?如果不是在应该创建的时候创建的,我是否应该收到诸如“无法创建表”之类的错误?

Bootstrap.groovy都被注释为使调试更容易。

DataSource.groovy
dataSource {
pooled = true
jmxExport = 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' // Hibernate 3
cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
singleSession = true // configure OSIV singleSession mode
flush.mode = 'manual' // OSIV session flush mode outside of transactional context
}

// environment specific settings
environments {
development {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
}
}...

BankAccount.groovy
class BankAccount {

SecUser user
String alias
String number

static constraints = {
alias nullable: false, blank: false
number nullable: false, blank: false
}
}

最佳答案

我相信这不是关键问题。我在项目中遇到相同的错误,但该应用程序仍然可以正常工作。

我认为此配置存在一些不一致之处。不是关于你,而是关于grails。

也许这篇文章回答了您的问题-> here

关于grails - 在Grails中找不到表 “XXX”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33994688/

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