-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: hbm2ddl mysql errors
PostPosted: Wed Jun 22, 2011 4:42 pm 
Newbie

Joined: Mon Mar 05, 2007 2:25 am
Posts: 12
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

_________________
PFfJ, the distributed Plugin Framework for Java.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.