6

I started my application today and when it starts I get this error

| 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]

Has anyone seen this before?

4

2 回答 2

20

There are some keys are not allowed in GORM: order, group or any other SQL keyword; also you can't name domain class User, Group(PostgreSQL).
To fix it read mapping and change table names and columns.

于 2012-09-14T13:48:43.090 回答
6

I have found out you cannot have field or domain with the name: order, group or any other SQL keyword.

于 2012-09-14T13:12:11.637 回答