以数据库错误开头的 Grails 有没有人看到这个

标签 grails ddl

我今天启动了我的应用程序,当它启动时出现此错误

| Error 2012-09-14 13:54:17,608 [pool-7-thread-1] ERROR hbm2ddl.SchemaExport - Unsuccessful: create table order (id bigint generated by default as identity, version bigint not null, date_created timestamp not null, order varchar(255) not null, picture_id bigint not null, posts_id bigint not null, primary key (id))

| Error 2012-09-14 13:54:17,609 [pool-7-thread-1] ERROR hbm2ddl.SchemaExport - Syntax error in SQL statement "CREATE TABLE ORDER[*] (ID BIGINT GENERATED BY DEFAULT AS IDENTITY, VERSION BIGINT NOT NULL, DATE_CREATED TIMESTAMP NOT NULL, ORDER VARCHAR(255) NOT NULL, PICTURE_ID BIGINT NOT NULL, POSTS_ID BIGINT NOT NULL, PRIMARY KEY (ID)) "; expected "identifier"; SQL statement: create table order (id bigint generated by default as identity, version bigint not null, date_created timestamp not null, order varchar(255) not null, picture_id bigint not null, posts_id bigint not null, primary key (id)) [42001-164]

| Error 2012-09-14 13:54:17,621 [pool-7-thread-1] ERROR hbm2ddl.SchemaExport - Unsuccessful: alter table order add constraint FK651874E9A8021F6 foreign key (posts_id) references post

| Error 2012-09-14 13:54:17,621 [pool-7-thread-1] ERROR hbm2ddl.SchemaExport - Syntax error in SQL statement "ALTER TABLE ORDER[*] ADD CONSTRAINT FK651874E9A8021F6 FOREIGN KEY (POSTS_ID) REFERENCES POST "; expected "identifier"; SQL statement: alter table order add constraint FK651874E9A8021F6 foreign key (posts_id) references post [42001-164]

| Error 2012-09-14 13:54:17,621 [pool-7-thread-1] ERROR hbm2ddl.SchemaExport - Unsuccessful: alter table order add constraint FK651874ED45FCA4B foreign key (picture_id) references picture

| Error 2012-09-14 13:54:17,621 [pool-7-thread-1] ERROR hbm2ddl.SchemaExport - Syntax error in SQL statement "ALTER TABLE ORDER[*] ADD CONSTRAINT FK651874ED45FCA4B FOREIGN KEY (PICTURE_ID) REFERENCES PICTURE "; expected "identifier"; SQL statement: alter table order add constraint FK651874ED45FCA4B foreign key (picture_id) references picture [42001-164]



有没有人见过这个?

最佳答案

GORM 中有一些关键字是不允许的:order、group 或任何其他 SQL 关键字;你也不能命名域类用户、组(PostgreSQL)。
要修复它,请阅读 mapping并更改表名和列。

关于以数据库错误开头的 Grails 有没有人看到这个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12425104/

相关文章:

sql-server - 从现有数据库生成 SQL DDL 和内容的工具

hibernate - HQL在where子句中使用参数

sql - 无法通过 grails 应用程序插入 MSSQL

grails - Grails/GORM中的错误:删除的对象将通过级联重新保存

ms-access - 在 Access 中查找和替换表/字段名称?

sql - DB2:多个表之间的外键约束

grails - Grails:以多对多关系添加数据会产生错误

grails - 为什么在 Grails 中使用 HibernateCriteriaBuilder 时收到 "Null value was assigned to a property of primitive type setter of"错误消息

oracle - 如何获取 Oracle 同义词的创建/最后 DDL 时间?

sql - 使用sql更改以 'C'字母开头的列名?