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