-->
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: Error with hibernate.hbm2ddl.auto 'create' routine
PostPosted: Fri Aug 19, 2016 6:52 am 
Newbie

Joined: Fri Aug 19, 2016 6:41 am
Posts: 1
Hello,

I want hibernate to drop all tables an recreate them on startup.
For this purpose hibernate proposes following routine:

<property name="hibernate.hbm2ddl.auto">create</property>

The problem is, that this does not work if my entities contail Many-To-Many associations with generated join tables. (same for parent-child association)
Reason is as far I can tell, that hibernate
1. removes all FK constraints of the entities
2. drops all entity tables
3. removes all FK constraints of generated join tables
4. drops the join tables

---> The problem is, that this will result in errors at 2., because 3. is not removed yet.

My workaround: drop and then create whole database direct with sql / mysql

Is there another possibile workaround with Hibernate? I dont / can't use my workaround effectively on a server.

Chees Constantin


Top
 Profile  
 
 Post subject: Re: Error with hibernate.hbm2ddl.auto 'create' routine
PostPosted: Mon Aug 29, 2016 3:46 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1630
Location: Romania
This might be a bug. Please provide a replicating test case and open a Jira issue.


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.