Hello,
I am using hibernate annotations in combination with hibernate tools. Everything is working fine. But when I run the generated sql script on my mysql database I get an error. This error is caused by the fact that there is a alter table statement at the start of the script. With an empty database, there is no table to alter.
SQL code:
Code:
alter table ACCOUNTS drop foreign key FKAF43ABE6361C85C5;
drop table if exists ACCOUNTS;
drop table if exists DOWNLOADABLE_CONTENT;
create table ACCOUNTS (ACCOUNT_ID integer not null auto_increment, NAME varchar(15) not null unique, PASSWORD varchar(15) not null, VERSION integer, avatar_CONTENT_ID integer, primary key (ACCOUNT_ID));
create table DOWNLOADABLE_CONTENT (CONTENT_TYPE varchar(31) not null, CONTENT_ID integer not null auto_increment, CONTENT longblob not null, type varchar(255), VERSION integer, primary key (CONTENT_ID));
alter table ACCOUNTS add index FKAF43ABE6361C85C5 (avatar_CONTENT_ID), add constraint FKAF43ABE6361C85C5 foreign key (avatar_CONTENT_ID) references DOWNLOADABLE_CONTENT (CONTENT_ID);
Does anyone have any ideas what causes this to be generated in this way, and how I can fix this?
Mark