Sunday, April 22, 2012

Grails Domain - ERROR hbm2ddl.SchemaExport - Unsuccessful: create table


| Error 2012-04-22 14:08:00,733 [Thread-8] ERROR hbm2ddl.SchemaExport  - Unsuccessful: create table education (id bigint not null, version bigint not null, field_of_study varchar(255) not null, from timestamp not null, grade varchar(255) not null, school_name varchar(255) not null, to timestamp, primary key (id))
| Error 2012-04-22 14:08:00,733 [Thread-8] ERROR hbm2ddl.SchemaExport  - Syntax error in SQL statement "CREATE TABLE EDUCATION (ID BIGINT NOT NULL, VERSION BIGINT NOT NULL, FIELD_OF_STUDY VARCHAR(255) NOT NULL, FROM[*] TIMESTAMP NOT NULL, GRADE VARCHAR(255) NOT NULL, SCHOOL_NAME VARCHAR(255) NOT NULL, TO TIMESTAMP, PRIMARY KEY (ID)) "; expected "identifier"; SQL statement:
create table education (id bigint not null, version bigint not null, field_of_study varchar(255) not null, from timestamp not null, grade varchar(255) not null, school_name varchar(255) not null, to timestamp, primary key (id)) [42001-147]
| Error 2012-04-22 14:08:00,905 [Thread-8] ERROR hbm2ddl.SchemaExport  - Unsuccessful: alter table my_edu_profile_education add constraint FKC6EB61F6B358A0A4 foreign key (education_id) references education
| Error 2012-04-22 14:08:00,921 [Thread-8] ERROR hbm2ddl.SchemaExport  - Table "EDUCATION" not found; SQL statement:
alter table my_edu_profile_education add constraint FKC6EB61F6B358A0A4 foreign key (education_id) references education [42102-147]


This error comes when you are using one of the keywords from the SQL in your domain class , for example, i was using From and To for one domain class for dates and it was not able to create tables .

Happy Coding
Kulveer Singh

2 comments:

  1. I am also fetting this kind of error, I am having a class named ToDo, does it make any problem.

    ReplyDelete
  2. Big thanks to your tips !
    I have a Check Table and it doesn't like it.I change the name and it works !

    ReplyDelete