尝试导入旧的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]
其他域名也无法加载。据我所知,如果我的DataSource包含
dbCreate的="创建降"
,每次重新启动应用程序时都应该重建数据库,不是吗?至少那是我记得的。因此,如果它找不到表格,那么它是否已被创建?如果它本来没有创建,我不应该得到另一个错误,例如"无法创建表" ?
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
}
}
答案 0 :(得分:1)