Grails 抛出错误 hbm2ddl.SchemaExport - HHH000389:不成功
Grails throws ERROR hbm2ddl.SchemaExport - HHH000389: Unsuccessful
出现此错误前的最后一件事 "I remember" 是更新到 openjdk8
Error 2015-01-12 14:19:44,751 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - HHH000389: Unsuccessful: create table post (id bigint generated by default as identity, version bigint not null, content varchar(255) not null, limit integer not null, posted_date timestamp not null, poster varchar(255) not null, title varchar(255) not null, primary key (id))
| Error 2015-01-12 14:19:44,755 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - Syntax error in SQL statement "CREATE TABLE POST (ID BIGINT GENERATED BY DEFAULT AS IDENTITY, VERSION BIGINT NOT NULL, CONTENT VARCHAR(255) NOT NULL, LIMIT[*] INTEGER NOT NULL, POSTED_DATE TIMESTAMP NOT NULL, POSTER VARCHAR(255) NOT NULL, TITLE VARCHAR(255) NOT NULL, PRIMARY KEY (ID)) "; expected "identifier"; SQL statement:
create table post (id bigint generated by default as identity, version bigint not null, content varchar(255) not null, limit integer not null, posted_date timestamp not null, poster varchar(255) not null, title varchar(255) not null, primary key (id)) [42001-176]
| Server running. Browse to http://localhost:8080/brewee
环境
- Ubuntu 14.04
- Grails 2.4.4
- javac 1.8.0_25
数据源
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
}
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"
}
}
我是 Grails 的新手。认为我已经做了关闭这个内存数据库的事情是正确的吗?我该如何解决这个问题?
输入H2方言
dialect = "org.hibernate.dialect.H2Dialect"
在 DataSource.groovy file.It 的数据源块中应该可以解决您的问题。
确保您没有遇到 This 问题。
出现此错误前的最后一件事 "I remember" 是更新到 openjdk8
Error 2015-01-12 14:19:44,751 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - HHH000389: Unsuccessful: create table post (id bigint generated by default as identity, version bigint not null, content varchar(255) not null, limit integer not null, posted_date timestamp not null, poster varchar(255) not null, title varchar(255) not null, primary key (id))
| Error 2015-01-12 14:19:44,755 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - Syntax error in SQL statement "CREATE TABLE POST (ID BIGINT GENERATED BY DEFAULT AS IDENTITY, VERSION BIGINT NOT NULL, CONTENT VARCHAR(255) NOT NULL, LIMIT[*] INTEGER NOT NULL, POSTED_DATE TIMESTAMP NOT NULL, POSTER VARCHAR(255) NOT NULL, TITLE VARCHAR(255) NOT NULL, PRIMARY KEY (ID)) "; expected "identifier"; SQL statement:
create table post (id bigint generated by default as identity, version bigint not null, content varchar(255) not null, limit integer not null, posted_date timestamp not null, poster varchar(255) not null, title varchar(255) not null, primary key (id)) [42001-176]
| Server running. Browse to http://localhost:8080/brewee
环境
- Ubuntu 14.04
- Grails 2.4.4
- javac 1.8.0_25
数据源
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
}
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"
}
}
我是 Grails 的新手。认为我已经做了关闭这个内存数据库的事情是正确的吗?我该如何解决这个问题?
输入H2方言
dialect = "org.hibernate.dialect.H2Dialect"
在 DataSource.groovy file.It 的数据源块中应该可以解决您的问题。
确保您没有遇到 This 问题。