从数据库错误开始的Grails有人见过这个

时间:2012-09-14 12:59:10

标签: grails ddl

我今天开始申请,当它开始时我收到此错误

  

|错误2012-09-14 13:54:17,608 [pool-7-thread-1]错误hbm2ddl.SchemaExport - 不成功:创建表顺序(默认情况下生成的id bigint为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,主键(id))

     

|错误2012-09-14 13:54:17,609 [pool-7-thread-1]错误hbm2ddl.SchemaExport - SQL语句中的语法错误“CREATE TABLE ORDER [*](ID BIGINT由DEFAULT生成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))“;预期的“标识符”; SQL语句:   创建表顺序(id bigint默认生成为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 ]

     

|错误2012-09-14 13:54:17,621 [pool-7-thread-1]错误hbm2ddl.SchemaExport - 不成功:alter table order add constraint FK651874E9A8021F6外键(posts_id)引用帖子

     

|错误2012-09-14 13:54:17,621 [pool-7-thread-1]错误hbm2ddl.SchemaExport - SQL语句中的语法错误“ALTER TABLE ORDER [*] ADD CONSTRAINT FK651874E9A8021F6 FOREIGN KEY(POSTS_ID)REFERENCES POST”;预期的“标识符”; SQL语句:   alter table order添加约束FK651874E9A8021F6外键(posts_id)引用帖子[42001-164]

     

|错误2012-09-14 13:54:17,621 [pool-7-thread-1]错误hbm2ddl.SchemaExport - 不成功:alter table order add constraint FK651874ED45FCA4B外键(picture_id)参考图片

     

|错误2012-09-14 13:54:17,621 [pool-7-thread-1]错误hbm2ddl.SchemaExport - SQL语句中的语法错误“ALTER TABLE ORDER [*] ADD CONSTRAINT FK651874ED45FCA4B FOREIGN KEY(PICTURE_ID)REFERENCES PICTURE”;预期的“标识符”; SQL语句:   alter table order add constraint FK651874ED45FCA4B外键(picture_id)参考图片[42001-164]

有没有人见过这个?

2 个答案:

答案 0 :(得分:20)

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

答案 1 :(得分:6)

我发现你不能拥有名称的字段或域:order,group或任何其他SQL关键字。