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.  [ 4 posts ] 
Author Message
 Post subject: problem in DDL from hbm2ddl for drop table with foreign key
PostPosted: Fri Dec 21, 2007 7:01 am 
Newbie

Joined: Thu Dec 20, 2007 7:44 am
Posts: 5
I am using the hbm2ddl Ant task to generate DDL from a hibernate mapping file. I set the "drop" attribute to true so that it will generate drop statements if tables already exist. This works fine until one of my tables contains a foreign key constraint, at this point the generated DDL puts the drop foreign key constraint at the top of the DDL but doesn't check if the table already exists - this causes the DDL to fail the first time it is run against a clean DB which doesn't contain the tables. The generated DDL looks like so:

alter table track_metadata drop foreign key FKD6002AE1F90DF610;
drop table if exists track_metadata;

Is there no way the "alter table" statement can check for existence of the table before it tries to drop the foreign key?

I am using the 3.2.0 GA release of hibernate tools.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 02, 2008 7:33 am 
Newbie

Joined: Thu Dec 20, 2007 7:44 am
Posts: 5
Hmmm, I see nobody has any thoughts on this, perhaps it should go into Jira as a bug? Seems like one to me....


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 02, 2008 2:02 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
sounds like a feature request - but what is the problem ? failed DML's in schemaexport/update are normally just ignored.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 02, 2008 2:48 pm 
Newbie

Joined: Thu Dec 20, 2007 7:44 am
Posts: 5
Well, whether they are ignored or not is configurable depending on what tool you are using to load the DDL. We would like to be able to stop on genuine DDL errors but have had to disable this to work around this issue. I'm happy to add it as a feature request in Jira....


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

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.