-->
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: double statement in ReleationalModel#sqlCreateString() ?
PostPosted: Thu Apr 03, 2008 1:32 pm 
Newbie

Joined: Thu Apr 03, 2008 1:24 pm
Posts: 1
Hi,

I am trying to offer the following two statements in an auxiliary database object during sqlCreateString() for creating a table with a foraeign key in a mysql database.

create table T_ATTR_SETS (C_MM_ID bigint not null, C_VALUE varchar(255), C_SET_NAME varchar(255) not null); alter table T_ATTR_SETS add index FK2A68DFB477160F21 (C_MM_ID), add constraint FK2A68DFB477160F21 foreign key (C_MM_ID) references MM (C_MM_ID);

This works if I do this with the mysql console but not with the auxiliare database object. Hibernate logging says the following. It is a mysql syntax error that is blamed. But the staement is exactly the same. What am I doing wrong?

[2008-04-03 19:22:07,730] [main] [INFO ] [org.hibernate.tool.hbm2ddl.SchemaExport] [Running hbm2ddl schema export]
[2008-04-03 19:22:07,730] [main] [DEBUG] [org.hibernate.tool.hbm2ddl.SchemaExport] [import file not found: /import.sql]
[2008-04-03 19:22:07,730] [main] [INFO ] [org.hibernate.tool.hbm2ddl.SchemaExport] [exporting generated schema to database]
[2008-04-03 19:22:07,731] [main] [DEBUG] [org.hibernate.tool.hbm2ddl.SchemaExport] [drop table T_ATTR_SETS]
[2008-04-03 19:22:07,735] [main] [DEBUG] [org.hibernate.tool.hbm2ddl.SchemaExport] [Unsuccessful: drop table T_ATTR_SETS]
[2008-04-03 19:22:07,735] [main] [DEBUG] [org.hibernate.tool.hbm2ddl.SchemaExport] [Unknown table 'T_ATTR_SETS']
[2008-04-03 19:22:07,736] [main] [DEBUG] [org.hibernate.tool.hbm2ddl.SchemaExport] [drop table if exists MM]
[2008-04-03 19:22:07,736] [main] [DEBUG] [org.hibernate.tool.hbm2ddl.SchemaExport] [create table MM (C_MM_ID bigint not null auto_increment, primary key (C_MM_ID))]
[2008-04-03 19:22:07,823] [main] [DEBUG] [org.hibernate.tool.hbm2ddl.SchemaExport] [create table T_ATTR_SETS (C_MM_ID bigint not null, C_VALUE varchar(255), C_SET_NAME varchar(255) not null); alter table T_ATTR_SETS add index FK2A68DFB477160F21 (C_MM_ID), add constraint FK2A68DFB477160F21 foreign key (C_MM_ID) references MM (C_MM_ID);]
[2008-04-03 19:22:07,824] [main] [ERROR] [org.hibernate.tool.hbm2ddl.SchemaExport] [Unsuccessful: create table T_ATTR_SETS (C_MM_ID bigint not null, C_VALUE varchar(255), C_SET_NAME varchar(255) not null); alter table T_ATTR_SETS add index FK2A68DFB477160F21 (C_MM_ID), add constraint FK2A68DFB477160F21 foreign key (C_MM_ID) references MM (C_MM_ID);]
[2008-04-03 19:22:07,824] [main] [ERROR] [org.hibernate.tool.hbm2ddl.SchemaExport] [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 '; alter table T_ATTR_SETS add index FK2A68DFB477160F21 (C_MM_ID), add constraint' at line 1]



Thanks very much for help.


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.