-->
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: auto DB generation problem
PostPosted: Fri Oct 29, 2004 8:45 am 
Newbie

Joined: Tue Apr 20, 2004 8:43 am
Posts: 6
Hibernate version: 2.1.6
DB mysql 4.0

I'm trying to generate ddl script by the help of hbm2ddl

Code:
alter table Employee drop constraint FK4AFD4ACE2C929929;
drop table if exists Employee;
drop table if exists Position;
drop table if exists Phone;
create table Employee (
   id bigint not null auto_increment,
   firstName varchar(255),
   lastName varchar(255),
   position bigint,
   phone tinyblob,
   state bit,
   primary key (id)
);
create table Position (
   id bigint not null auto_increment,
   positionName varchar(255),
   primary key (id)
);
create table Phone (
   id bigint not null auto_increment,
   number varchar(255),
   primary key (id)
);
alter table Employee add index FK4AFD4ACE2C929929 (position), add constraint FK4AFD4ACE2C929929 foreign key (position) references Position (id);


and when I'm trying to execute it by the help of ant

Code:
<target name="db-create-tables">
      <sql
         driver="${db.connection.driver_class}"
         url="${db.connection.url}"
         userid="${db.connection.username}"
         password="${db.connection.password}"
         src="etc/create_tables.ddl"
         classpathref="compile.classpath"
         onerror="continue"
         />
   </target>


I've got an error

Code:
[sql] Failed to execute:  alter table Employee drop constraint FK4AFD4ACE2C929929
      [sql] java.sql.SQLException: Syntax error or access violation message from server: "You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'constraint FK4AFD4ACE2C929929' at line 1"
      [sql] 7 of 8 SQL statements executed successfully



Could anybody explain the reason of this error


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.