-->
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.  [ 2 posts ] 
Author Message
 Post subject: Only want to run the creation database script.
PostPosted: Wed Oct 05, 2011 3:12 am 
Newbie

Joined: Wed Jul 09, 2008 12:36 pm
Posts: 1
Hi all,

In the Hibernate 4.0.0.Beta1, when I passed the property of 'hibernate.hbm2ddl.auto=create' into EntityManagerFactory, it will help me create the database script, which is generated by Hibernate itself, properly. However, with upgrading to the Hibernate 4.0.0.CR2, I've found before running the creation script, it will run the drop script, which result in throwing out some ERROR message. I've checked the hibernate source code, found the following change. (in SchemaExport.java)

Code:
   /**
    * Run the schema creation script; drop script is automatically
    * executed before running the creation script.
    *
    * @param output the target of the script.
    */
   public void create(Target output) {
      // need to drop tables before creating so need to specify Type.BOTH
      execute( output, Type.BOTH );
   }


Before, it was TYPE.CREATE.

The problem with running database drop script firstly is that it will throw ERROR message when running the foreign key constraints drop statement, as those tables were not existed at first time. ERROR messages are like following:

Code:
18:27:24,818 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-4) Table "BPEL_MESSAGE_ROUTE" not found; SQL statement:
alter table BPEL_MESSAGE_ROUTE drop constraint FKD55AB687DB5AB781 [42102-145]
18:27:24,821 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-4) HHH00389:Unsuccessful: alter table BPEL_MEX_PROP drop constraint FKAE75920CAA079EB8
18:27:24,822 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-4) Table "BPEL_MEX_PROP" not found; SQL statement:
alter table BPEL_MEX_PROP drop constraint FKAE75920CAA079EB8 [42102-145]
18:27:24,822 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-4) HHH00389:Unsuccessful: alter table BPEL_PARTNER_LINK drop constraint FKA7809BBB21712AFA


Do we have any configurations (or workarounds) to remove this sort of error?

Thanks
Jeff


Top
 Profile  
 
 Post subject: Re: Only want to run the creation database script.
PostPosted: Wed Oct 05, 2011 4:22 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 11, 2009 2:26 am
Posts: 29
https://hibernate.onjira.com/browse/HHH-6384


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.